Skip to content

Commit

Permalink
Merge pull request #60 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
[pull] dev from KelvinTegelaar:dev
  • Loading branch information
kris6673 authored Jul 19, 2024
2 parents 06fb3ff + 9e51170 commit 392ac18
Show file tree
Hide file tree
Showing 4 changed files with 357 additions and 118 deletions.
13 changes: 10 additions & 3 deletions src/components/utilities/CippActionsOffcanvas.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import ReactTimeAgo from 'react-time-ago'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faGlobe } from '@fortawesome/free-solid-svg-icons'
import { cellGenericFormatter } from '../tables/CellGenericFormat'
import ReactSelect from 'react-select'

const CippOffcanvasCard = ({ action, key }) => {
const [offcanvasVisible, setOffcanvasVisible] = useState(false)
Expand Down Expand Up @@ -111,11 +112,14 @@ export default function CippActionsOffcanvas(props) {
const handleModal = useCallback(
(modalMessage, modalUrl, modalType = 'GET', modalBody, modalInput, modalDropdown) => {
const handlePostConfirm = () => {
const selectedValue = inputRef.current.value
console.log(inputRef)
const selectedValue = inputRef.current.props?.id
? inputRef.current.props.value.value
: inputRef.current.value
//console.log(inputRef)
let additionalFields = {}

if (inputRef.current.nodeName === 'SELECT') {
if (inputRef.current.props?.id) {
const selectedItem = dropDownInfo.data.find(
(item) => item[modalDropdown.valueField] === selectedValue,
)
Expand Down Expand Up @@ -190,7 +194,10 @@ export default function CippActionsOffcanvas(props) {
{modalDropdown && (
<div>
{dropDownInfo.isSuccess && (
<CFormSelect
<ReactSelect
id="react-select-offcanvas"
classNamePrefix="react-select"
className="react-select-container"
ref={inputRef}
options={dropDownInfo.data.map((data) => ({
value: data[modalDropdown.valueField],
Expand Down
14 changes: 14 additions & 0 deletions src/views/email-exchange/administration/MailboxesList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,20 @@ const MailboxList = () => {
modalMessage:
'Are you sure you want to start the managed folder assistant for the user?',
},
{
label: 'Set mailbox locale',
color: 'info',
modal: true,
modalType: 'POST',
modalBody: {
user: row.UPN,
TenantFilter: tenant.defaultDomainName,
ProhibitSendQuota: true,
},
modalUrl: `/api/ExecSetMailboxLocale`,
modalInput: true,
modalMessage: 'Enter a locale, e.g. en-US',
},
{
label: 'Set Send Quota',
color: 'info',
Expand Down
205 changes: 160 additions & 45 deletions src/views/identity/administration/RiskyUsers.jsx
Original file line number Diff line number Diff line change
@@ -1,54 +1,151 @@
import React, { useState } from 'react'
import { useSelector } from 'react-redux'
import { CippPageList } from 'src/components/layout'

const columns = [
{
name: 'Risk Last Updated Date',
selector: (row) => row['riskLastUpdatedDateTime'],
sortable: true,
exportSelector: 'riskLastUpdatedDateTime',
},
{
name: 'User Principal Name',
selector: (row) => row['userPrincipalName'],
sortable: true,
exportSelector: 'userPrincipalName',
},
{
name: 'Risk Level',
selector: (row) => row['riskLevel'],
sortable: true,
exportSelector: 'riskLevel',
},
{
name: 'Risk State',
selector: (row) => row['riskState'],
sortable: true,
exportSelector: 'riskState',
},
{
name: 'Risk Detail',
selector: (row) => row['riskDetail'],
sortable: true,
exportSelector: 'riskDetail',
},
{
name: 'isProcessing',
selector: (row) => row['isProcessing'],
sortable: true,
exportSelector: 'isProcessing',
},
{
name: 'isDeleted',
selector: (row) => row['isDeleted'],
sortable: true,
exportSelector: 'isDeleted',
},
]
import { CButton } from '@coreui/react'
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faEllipsisV, faMinusCircle, faPaperPlane, faEye } from '@fortawesome/free-solid-svg-icons'
import { CippActionsOffcanvas } from 'src/components/utilities'
import { Link, useSearchParams } from 'react-router-dom'

const RiskyUsers = () => {
const tenant = useSelector((state) => state.app.currentTenant)

const Offcanvas = (row, rowIndex, formatExtraData) => {
const [ocVisible, setOCVisible] = useState(false)
const viewLink = `/identity/administration/ViewBec?userId=${row.id}&tenantDomain=${tenant.defaultDomainName}&ID=${row.userPrincipalName}`
return (
<>
<Link to={viewLink}>
<CButton size="sm" variant="ghost" color="success">
<FontAwesomeIcon icon={faEye} />
</CButton>
</Link>
<CButton size="sm" color="link" onClick={() => setOCVisible(true)}>
<FontAwesomeIcon icon={faEllipsisV} />
</CButton>
<CippActionsOffcanvas
title="Extended Information"
extendedInfo={[
{
label: 'User ID',
value: row.id,
},
{
label: 'Display Name',
value: row.userDisplayName,
},
{
label: 'User Principal',
value: row.userPrincipalName,
},
{
label: 'riskLastUpdatedDateTime',
value: row.riskLastUpdatedDateTime,
},
{
label: 'riskLevel',
value: row.riskLevel,
},
{
label: 'riskState',
value: row.riskState,
},
{
label: 'riskDetail',
value: row.riskDetail,
},
{
label: 'isProcessing',
value: row.isProcessing,
},
{
label: 'isDeleted',
value: row.isDeleted,
},
]}
actions={[
{
label: 'Research Compromised Account',
link: `/identity/administration/ViewBec?userId=${row.id}&tenantDomain=${tenant.defaultDomainName}&ID=${row.userPrincipalName}`,
color: 'info',
},
{
label: 'Dismiss User Risk',
color: 'info',
modal: true,
modalUrl: `/api/ExecDismissRiskyUser?TenantFilter=${tenant.defaultDomainName}&userid=${row.id}&userDisplayName=${row.userDisplayName}`,
modalMessage: 'Are you sure you want to dismiss this users risk?',
icon: <FontAwesomeIcon icon={faPaperPlane} className="me-2" />,
},
/* TODO Add action for Compromised
{
label: 'Confirm Compromised',
color: 'info',
modal: true,
modalUrl: `/api/ExecBECRemediate?TenantFilter=${tenant.defaultDomainName}&userid=${row.id}`,
modalMessage: 'Are you sure you want to confirm this user as compromised?',
icon: <FontAwesomeIcon icon={faMinusCircle} className="me-2" />,
},*/
]}
placement="end"
visible={ocVisible}
id={row.id}
hideFunction={() => setOCVisible(false)}
/>
</>
)
}

const columns = [
{
name: 'Risk Last Updated Date',
selector: (row) => row['riskLastUpdatedDateTime'],
sortable: true,
exportSelector: 'riskLastUpdatedDateTime',
},
{
name: 'User Principal Name',
selector: (row) => row['userPrincipalName'],
sortable: true,
exportSelector: 'userPrincipalName',
},
{
name: 'Risk Level',
selector: (row) => row['riskLevel'],
sortable: true,
exportSelector: 'riskLevel',
},
{
name: 'Risk State',
selector: (row) => row['riskState'],
sortable: true,
exportSelector: 'riskState',
},
{
name: 'Risk Detail',
selector: (row) => row['riskDetail'],
sortable: true,
exportSelector: 'riskDetail',
},
{
name: 'isProcessing',
selector: (row) => row['isProcessing'],
sortable: true,
exportSelector: 'isProcessing',
},
{
name: 'isDeleted',
selector: (row) => row['isDeleted'],
sortable: true,
exportSelector: 'isDeleted',
},
{
name: 'Actions',
cell: Offcanvas,
maxWidth: '100px',
},
]

return (
<>
<CippPageList
Expand Down Expand Up @@ -94,6 +191,24 @@ const RiskyUsers = () => {
$count: true,
$orderby: 'riskLastUpdatedDateTime desc',
},
tableProps: {
selectableRows: true,
actionsList: [
{
label: 'Dismiss Risk',
color: 'info',
model: true,
modalUrl: `/api/ExecDismissRiskyUser?TenantFilter=${tenant.defaultDomainName}&userid=!id&userDisplayName=!userDisplayName`,
},
/* TODO Add action for Compromised
{
label: 'Confirm Compromised',
color: 'danger',
model: true,
modalUrl: `/api/ExecBECRemediate?TenantFilter=${tenant.defaultDomainName}&userid=!id`,
},*/
],
},
}}
/>
</>
Expand Down
Loading

0 comments on commit 392ac18

Please sign in to comment.