Skip to content

Commit 197a7e0

Browse files
authored
Merge pull request #178 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 58dd643 + a1b8ebe commit 197a7e0

File tree

5 files changed

+89
-26
lines changed

5 files changed

+89
-26
lines changed

src/data/extensionDataMapping.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
"type": "array",
3636
"targetObject": "user",
3737
"sourceMatchProperty": "Identity",
38-
"destinationMatchProperty": "id",
38+
"destinationMatchProperty": ["id", "mailNickname"],
3939
"storeAs": "json",
40-
"select": "Identity,User,AccessRights,IsInherited,Deny,InheritanceType,UserSid,IsOwner"
40+
"select": "User,AccessRights"
4141
},
4242
"CASMailbox": {
4343
"description": "List of CAS mailboxes mapped to their corresponding user via id. Properties can be mapped individually.",

src/pages/identity/administration/groups/edit.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const EditGroup = () => {
3434
const formControl = useForm({
3535
mode: "onChange",
3636
defaultValues: {
37-
tenantId: tenantFilter,
37+
tenantFilter: tenantFilter,
3838
},
3939
});
4040

@@ -57,7 +57,7 @@ const EditGroup = () => {
5757
setCombinedData(combinedData);
5858

5959
formControl.reset({
60-
tenantId: tenantFilter,
60+
tenantFilter: tenantFilter,
6161
mail: group.mail,
6262
allowExternal: groupInfo?.data?.allowExternal,
6363
sendCopies: groupInfo?.data?.sendCopies,

src/pages/tenant/standards/compare/index.js

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,34 @@ const Page = () => {
9898
);
9999

100100
// Determine compliance status
101-
const isCompliant =
102-
currentTenantStandard &&
103-
JSON.stringify(currentTenantStandard.value) === JSON.stringify(standardSettings);
101+
let isCompliant = false;
102+
103+
// Check if the standard is directly in the tenant object (like "standards.AuditLog": true)
104+
const standardIdWithoutPrefix = standardId.replace('standards.', '');
105+
const directStandardValue = currentTenantObj?.[standardId];
106+
107+
// Special case for boolean standards that are true in the tenant
108+
if (directStandardValue === true) {
109+
// If the standard is directly in the tenant and is true, it's compliant
110+
isCompliant = true;
111+
} else if (directStandardValue !== undefined) {
112+
// For non-boolean values, use strict equality
113+
isCompliant = JSON.stringify(directStandardValue) === JSON.stringify(standardSettings);
114+
} else if (currentTenantStandard) {
115+
// Fall back to the previous logic if the standard is not directly in the tenant object
116+
if (typeof standardSettings === 'boolean' && standardSettings === true) {
117+
isCompliant = currentTenantStandard.value === true;
118+
} else {
119+
isCompliant = JSON.stringify(currentTenantStandard.value) === JSON.stringify(standardSettings);
120+
}
121+
}
104122

123+
// Use the direct standard value from the tenant object if it exists
124+
105125
allStandards.push({
106126
standardId,
107127
standardName: standardInfo?.label || standardKey,
108-
currentTenantValue: currentTenantStandard?.value,
128+
currentTenantValue: directStandardValue !== undefined ? directStandardValue : currentTenantStandard?.value,
109129
standardValue: standardSettings,
110130
complianceStatus: isCompliant ? "Compliant" : "Non-Compliant",
111131
complianceDetails: standardInfo?.docsDescription || standardInfo?.helpText || "",
@@ -375,8 +395,8 @@ const Page = () => {
375395
{key}:
376396
</Typography>
377397
<Typography variant="body2">
378-
{typeof value === "object"
379-
? value.label || JSON.stringify(value)
398+
{typeof value === "object" && value !== null
399+
? (value.label || JSON.stringify(value))
380400
: value === true
381401
? "Enabled"
382402
: value === false
@@ -511,17 +531,23 @@ const Page = () => {
511531
<Typography
512532
variant="body2"
513533
sx={{
514-
color: isDifferent ? "error.main" : "inherit",
515-
fontWeight: isDifferent ? "medium" : "inherit",
534+
color: standard.complianceStatus === "Compliant"
535+
? "success.main"
536+
: (isDifferent ? "error.main" : "inherit"),
537+
fontWeight: standard.complianceStatus !== "Compliant" && isDifferent
538+
? "medium"
539+
: "inherit",
516540
}}
517541
>
518-
{typeof value === "object"
519-
? value.label || JSON.stringify(value)
520-
: value === true
521-
? "Enabled"
522-
: value === false
523-
? "Disabled"
524-
: String(value)}
542+
{standard.complianceStatus === "Compliant" && value === true
543+
? "Compliant"
544+
: (typeof value === "object" && value !== null
545+
? (value.label || JSON.stringify(value))
546+
: value === true
547+
? "Enabled"
548+
: value === false
549+
? "Disabled"
550+
: String(value))}
525551
</Typography>
526552
</Box>
527553
);
@@ -533,18 +559,20 @@ const Page = () => {
533559
sx={{
534560
whiteSpace: "pre-wrap",
535561
color:
536-
standard.currentTenantValue !== standard.standardValue
537-
? "error.main"
538-
: "inherit",
562+
standard.complianceStatus === "Compliant"
563+
? "success.main"
564+
: "error.main",
539565
fontWeight:
540-
standard.currentTenantValue !== standard.standardValue
566+
standard.complianceStatus !== "Compliant"
541567
? "medium"
542568
: "inherit",
543569
}}
544570
>
545-
{standard.currentTenantValue !== undefined
546-
? String(standard.currentTenantValue)
547-
: "Not configured"}
571+
{standard.complianceStatus === "Compliant" && standard.currentTenantValue === true
572+
? "Compliant"
573+
: (standard.currentTenantValue !== undefined
574+
? String(standard.currentTenantValue)
575+
: "Not configured")}
548576
</Typography>
549577
)}
550578
</Box>

src/utils/get-cipp-formatting.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,20 @@ export const getCippFormatting = (data, cellName, type, canReceive) => {
323323
);
324324
}
325325

326+
if (cellName === 'AccessRights') {
327+
// Handle data as an array or string
328+
const accessRights = Array.isArray(data)
329+
? data.flatMap((item) => (typeof item === "string" ? item.split(", ") : []))
330+
: typeof data === "string"
331+
? data.split(", ")
332+
: [];
333+
return isText
334+
? accessRights.join(", ")
335+
: accessRights.map((accessRight) => (
336+
<CippCopyToClipBoard key={accessRight} text={accessRight} type="chip" />
337+
));
338+
}
339+
326340
// Handle null or undefined data
327341
if (data === null || data === undefined) {
328342
return isText ? (
@@ -519,6 +533,18 @@ export const getCippFormatting = (data, cellName, type, canReceive) => {
519533

520534
// Handle arrays of strings
521535
if (Array.isArray(data) && data.every((item) => typeof item === "string")) {
536+
// if string matches json format, parse it
537+
if (data.every((item) => item.startsWith("{") || item.startsWith("["))) {
538+
return isText ? (
539+
JSON.stringify(data)
540+
) : (
541+
<CippDataTableButton
542+
data={data.map((item) => JSON.parse(item))}
543+
tableTitle={getCippTranslation(cellName)}
544+
/>
545+
);
546+
}
547+
522548
//if the array is empty, return "No data"
523549
return isText
524550
? data.join(", ")

src/utils/get-cipp-translation.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@ export const getCippTranslation = (field) => {
55
return "No data";
66
}
77

8+
// special translations for extensions
9+
if (field.startsWith("extension_")) {
10+
field = field.split("_").pop();
11+
}
12+
// special translation for schema extensions
13+
if (field.startsWith("ext") && field.includes("_")) {
14+
field = field.split("_").pop();
15+
}
16+
817
return (
918
CippTranslations[field] ||
1019
field

0 commit comments

Comments
 (0)