Skip to content

Commit

Permalink
Merge pull request #101 from KelvinTegelaar/dev
Browse files Browse the repository at this point in the history
[pull] dev from KelvinTegelaar:dev
  • Loading branch information
BNWEIN authored Jun 26, 2024
2 parents 012ce84 + 4284f7e commit fcf1cb6
Show file tree
Hide file tree
Showing 11 changed files with 278 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cipp",
"version": "5.8.5",
"version": "5.9.0",
"description": "The CyberDrain Improved Partner Portal is a portal to help manage administration for Microsoft Partners.",
"homepage": "https://cipp.app/",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion public/version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.8.5
5.9.0
10 changes: 10 additions & 0 deletions src/_nav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ const _nav = [
name: 'Users',
to: '/identity/administration/users',
},
{
component: CNavItem,
name: 'Risky Users',
to: '/identity/administration/risky-users',
},
{
component: CNavItem,
name: 'Groups',
Expand Down Expand Up @@ -114,6 +119,11 @@ const _nav = [
name: 'AAD Connect Report',
to: '/identity/reports/azure-ad-connect-report',
},
{
component: CNavItem,
name: 'Risk Detections',
to: '/identity/reports/risk-detections',
},
],
},
{
Expand Down
10 changes: 8 additions & 2 deletions src/components/layout/AppHeader.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,19 @@ const AppHeader = () => {
//check if the value of this key is false. If so, set the setupCompleted state to false
//if none is found, set the setupCompleted state to true
useEffect(() => {
if (dashboard && dashboard.length >= 1) {
const setupCompleted = dashboard.find((alert) => alert.setupCompleted === false)
if (dashboard && Array.isArray(dashboard) && dashboard.length >= 1) {
console.log('Finding if setup is completed.')
const setupCompleted = dashboard.find((alert) => alert && alert.setupCompleted === false)
if (setupCompleted) {
console.log("Setup isn't completed yet, we found a match with false.")
dispatch(setSetupCompleted({ setupCompleted: false }))
} else {
console.log('Setup is completed.')
dispatch(setSetupCompleted({ setupCompleted: true }))
}
} else {
console.log('Setup is completed.')
dispatch(setSetupCompleted({ setupCompleted: true }))
}
}, [dashboard, dispatch])

Expand Down
16 changes: 9 additions & 7 deletions src/components/tables/CippTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,13 @@ export default function CippTable({
Object.assign(output, flatten(value, newKey))
} else {
if (Array.isArray(value)) {
value.map((item, idx) => {
Object.assign(output, flatten(item, `${newKey}[${idx}]`))
})
if (typeof value[0] === 'object') {
value.map((item, idx) => {
Object.assign(output, flatten(item, `${newKey}[${idx}]`))
})
} else {
output[newKey] = value
}
} else {
output[newKey] = value
}
Expand Down Expand Up @@ -683,8 +687,7 @@ export default function CippTable({
})
return Array.isArray(exportData) && exportData.length > 0
? exportData.map((obj) => {
const flattenedObj = flatten(obj)
return applyFormatter(flattenedObj)
return flatten(applyFormatter(obj))
})
: []
}
Expand All @@ -695,8 +698,7 @@ export default function CippTable({
// Adjusted dataFlat processing to include formatting
let dataFlat = Array.isArray(data)
? data.map((item) => {
const flattenedItem = flatten(item)
return applyFormatter(flattenedItem)
return flatten(applyFormatter(item))
})
: []
if (!disablePDFExport) {
Expand Down
2 changes: 2 additions & 0 deletions src/importsMap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import React from 'react'
"/identity/administration/jit-admin": React.lazy(() => import('./views/identity/administration/DeployJITAdmin')),
"/identity/administration/ViewBec": React.lazy(() => import('./views/identity/administration/ViewBEC')),
"/identity/administration/users": React.lazy(() => import('./views/identity/administration/Users')),
"/identity/administration/risky-users": React.lazy(() => import('./views/identity/administration/RiskyUsers')),
"/identity/administration/devices": React.lazy(() => import('./views/identity/administration/Devices')),
"/identity/administration/groups/add": React.lazy(() => import('./views/identity/administration/AddGroup')),
"/identity/administration/group-templates": React.lazy(() => import('./views/identity/administration/GroupTemplates')),
Expand All @@ -32,6 +33,7 @@ import React from 'react'
"/identity/reports/inactive-users-report": React.lazy(() => import('./views/identity/reports/InactiveUsers')),
"/identity/reports/Signin-report": React.lazy(() => import('./views/identity/reports/SignIns')),
"/identity/reports/azure-ad-connect-report": React.lazy(() => import('./views/identity/reports/AzureADConnectReport')),
"/identity/reports/risk-detections": React.lazy(() => import('./views/identity/reports/RiskDetections')),
"/tenant/administration/tenants": React.lazy(() => import('./views/tenant/administration/Tenants')),
"/tenant/administration/tenants/edit": React.lazy(() => import('./views/tenant/administration/EditTenant')),
"/tenant/administration/partner-relationships": React.lazy(() => import('./views/tenant/administration/PartnerRelationships')),
Expand Down
12 changes: 12 additions & 0 deletions src/routes.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@
"component": "views/identity/administration/Users",
"allowedRoles": ["admin", "editor", "readonly"]
},
{
"path": "/identity/administration/risky-users",
"name": "Risky Users",
"component": "views/identity/administration/RiskyUsers",
"allowedRoles": ["admin", "editor", "readonly"]
},
{
"path": "/identity/administration/devices",
"name": "Devices",
Expand Down Expand Up @@ -206,6 +212,12 @@
"component": "views/identity/reports/AzureADConnectReport",
"allowedRoles": ["admin", "editor", "readonly"]
},
{
"path": "/identity/reports/risk-detections",
"name": "Risk Detections",
"component": "views/identity/reports/RiskDetections",
"allowedRoles": ["admin", "editor", "readonly"]
},
{
"path": "/tenant",
"name": "Tenant",
Expand Down
103 changes: 103 additions & 0 deletions src/views/identity/administration/RiskyUsers.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
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',
},
]

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

return (
<>
<CippPageList
title="Risky Users"
capabilities={{ allTenants: true, helpContext: 'https://google.com' }}
datatable={{
filterlist: [
{
filterName: 'State: none',
filter: 'Complex: riskState eq none',
},
{
filterName: 'State: atRisk',
filter: 'Complex: riskState eq atRisk',
},
{
filterName: 'State: confirmedCompromised',
filter: 'Complex: riskState eq confirmedCompromised',
},
{
filterName: 'State: confirmedSafe',
filter: 'Complex: riskState eq confirmedSafe',
},
{
filterName: 'State: dismissed',
filter: 'Complex: riskState eq dismissed',
},
{
filterName: 'State: remediated',
filter: 'Complex: riskState eq remediated',
},
{
filterName: 'State: unknownFutureValue',
filter: 'Complex: riskState eq unknownFutureValue',
},
],
columns: columns,
path: `api/ListGraphRequest`,
reportName: `${tenant?.defaultDomainName}-ListRiskyUsers`,
params: {
TenantFilter: tenant?.defaultDomainName,
Endpoint: `identityProtection/riskyUsers`,
$count: true,
$orderby: 'riskLastUpdatedDateTime',
},
}}
/>
</>
)
}

export default RiskyUsers
125 changes: 125 additions & 0 deletions src/views/identity/reports/RiskDetections.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
import { useSelector } from 'react-redux'
import { CippPageList } from 'src/components/layout'
import { CellTip } from 'src/components/tables'

const columns = [
{
name: 'Detected Date',
selector: (row) => row['detectedDateTime'],
sortable: true,
exportSelector: 'detectedDateTime',
},
{
name: 'User Principal Name',
selector: (row) => row['userPrincipalName'],
sortable: true,
exportSelector: 'userPrincipalName',
},
{
name: 'Location',
selector: (row) => `${row.location?.city} - ${row.location?.countryOrRegion}`,
sortable: true,
exportSelector: 'Location',
cell: (row) => CellTip(`${row.location?.city} - ${row.location?.countryOrRegion}`),
},
{
name: 'IP Address',
selector: (row) => row['ipAddress'],
sortable: true,
exportSelector: 'ipAddress',
},
{
name: 'Risk State',
selector: (row) => row['riskState'],
sortable: true,
exportSelector: 'riskState',
},
{
name: 'Risk Detail',
selector: (row) => row['riskDetail'],
sortable: true,
exportSelector: 'riskDetail',
},
{
name: 'Risk Level',
selector: (row) => row['riskLevel'],
sortable: true,
exportSelector: 'riskLevel',
},
{
name: 'Risk Type',
selector: (row) => row['riskType'],
sortable: true,
exportSelector: 'riskType',
},
{
name: 'Risk Event Type',
selector: (row) => row['riskEventType'],
sortable: true,
exportSelector: 'riskEventType',
},
{
name: 'Detection Type',
selector: (row) => row['detectionTimingType'],
sortable: true,
exportSelector: 'detectionTimingType',
},
{
name: 'Activity',
selector: (row) => row['activity'],
sortable: true,
exportSelector: 'activity',
},
]

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

return (
<>
<CippPageList
title="Risk Detection Report"
capabilities={{ allTenants: true, helpContext: 'https://google.com' }}
datatable={{
filterlist: [
{
filterName: 'State: atRisk',
filter: 'Complex: riskState eq atRisk',
},
{
filterName: 'State: confirmedCompromised',
filter: 'Complex: riskState eq confirmedCompromised',
},
{
filterName: 'State: confirmedSafe',
filter: 'Complex: riskState eq confirmedSafe',
},
{
filterName: 'State: dismissed',
filter: 'Complex: riskState eq dismissed',
},
{
filterName: 'State: remediated',
filter: 'Complex: riskState eq remediated',
},
{
filterName: 'State: unknownFutureValue',
filter: 'Complex: riskState eq unknownFutureValue',
},
],
columns: columns,
path: `api/ListGraphRequest`,
reportName: `${tenant?.defaultDomainName}-RiskDetections-Report`,
params: {
TenantFilter: tenant?.defaultDomainName,
Endpoint: `identityProtection/riskDetections`,
$count: true,
$orderby: 'detectedDateTime',
},
}}
/>
</>
)
}

export default RiskDetections
6 changes: 6 additions & 0 deletions src/views/identity/reports/SignIns.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ const SignInsReport = () => {
title="Sign Ins Report"
capabilities={{ allTenants: false, helpContext: 'https://google.com' }}
datatable={{
filterlist: [
{
filterName: 'Risky sign-ins',
filter: 'Complex: riskState ne none',
},
],
columns: columns,
path: `/api/ListSignIns`,
reportName: `${tenant?.defaultDomainName}-SignIns-Report`,
Expand Down
2 changes: 1 addition & 1 deletion version_latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.8.5
5.9.0

0 comments on commit fcf1cb6

Please sign in to comment.