Skip to content

Commit

Permalink
Merge pull request KelvinTegelaar#2697 from Ren-Roros-Digital/dismiss…
Browse files Browse the repository at this point in the history
…risk

Added Dismiss Risky User
  • Loading branch information
KelvinTegelaar authored Jul 18, 2024
2 parents 06fb3ff + e94a976 commit 8d5c915
Show file tree
Hide file tree
Showing 2 changed files with 333 additions and 115 deletions.
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 8d5c915

Please sign in to comment.