Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/components/CippComponents/CippUserActions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export const useCippUserActions = () => {
labelField: (option) =>
option?.calculatedGroupType
? `${option.displayName} (${option.calculatedGroupType})`
: option?.displayName ?? "",
: (option?.displayName ?? ""),
valueField: "id",
addedField: {
groupType: "groupType",
Expand Down Expand Up @@ -549,6 +549,17 @@ export const useCippUserActions = () => {
"Are you sure you want to change the source of authority for [userPrincipalName]? Setting it to On-Premises Managed will take until the next sync cycle to show the change.",
multiPost: false,
},
{
label: "Reprocess License Assignments",
type: "POST",
icon: <CloudDone />,
url: "/api/ExecReprocessUserLicenses",
data: { ID: "id", userPrincipalName: "userPrincipalName" },
confirmText:
"Are you sure you want to reprocess license assignments for [userPrincipalName]?",
multiPost: false,
condition: (row) => canWriteUser,
},
{
label: "Revoke all user sessions",
type: "POST",
Expand Down
7 changes: 6 additions & 1 deletion src/pages/identity/administration/groups/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ const Page = () => {
"mailEnabled",
"securityEnabled",
"visibility",
"assignedLicenses",
"licenseProcessingState.state",
"onPremisesSamAccountName",
"membershipRule",
"onPremisesSyncEnabled",
],
actions: actions,
};
Expand Down Expand Up @@ -320,11 +325,11 @@ const Page = () => {
"mailNickname",
"groupType",
"assignedLicenses",
"licenseProcessingState.state",
"visibility",
"onPremisesSamAccountName",
"membershipRule",
"onPremisesSyncEnabled",
"userPrincipalName",
]}
/>
);
Expand Down
4 changes: 3 additions & 1 deletion src/pages/identity/administration/users/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const Page = () => {
"onPremisesLastSyncDateTime", // OnPrem Last Sync
"onPremisesDistinguishedName", // OnPrem DN
"otherMails", // Alternate Email Addresses
"licenseAssignmentStates", // License Assignment States
],
actions: userActions,
};
Expand Down Expand Up @@ -85,7 +86,7 @@ const Page = () => {
Endpoint: "users",
manualPagination: true,
$select:
"id,accountEnabled,businessPhones,city,createdDateTime,companyName,country,department,displayName,faxNumber,givenName,isResourceAccount,jobTitle,mail,mailNickname,mobilePhone,officeLocation,otherMails,postalCode,preferredDataLocation,preferredLanguage,proxyAddresses,showInAddressList,state,streetAddress,surname,usageLocation,userPrincipalName,userType,assignedLicenses,onPremisesSyncEnabled,OnPremisesImmutableId,onPremisesLastSyncDateTime,onPremisesDistinguishedName",
"id,accountEnabled,businessPhones,city,createdDateTime,companyName,country,department,displayName,faxNumber,givenName,isResourceAccount,jobTitle,mail,mailNickname,mobilePhone,officeLocation,otherMails,postalCode,preferredDataLocation,preferredLanguage,proxyAddresses,showInAddressList,state,streetAddress,surname,usageLocation,userPrincipalName,userType,assignedLicenses,licenseAssignmentStates,onPremisesSyncEnabled,OnPremisesImmutableId,onPremisesLastSyncDateTime,onPremisesDistinguishedName",
$count: true,
$orderby: "displayName",
$top: 999,
Expand All @@ -101,6 +102,7 @@ const Page = () => {
"businessPhones",
"proxyAddresses",
"assignedLicenses",
"licenseAssignmentStates",
]}
filters={filters}
/>
Expand Down
73 changes: 51 additions & 22 deletions src/utils/get-cipp-formatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,14 @@ export const getCippFormatting = (data, cellName, type, canReceive, flatten = tr
unit === "d"
? "day"
: unit === "h"
? "hour"
: unit === "w"
? "week"
: unit === "m"
? "minutes"
: unit === "y"
? "year"
: unit;
? "hour"
: unit === "w"
? "week"
: unit === "m"
? "minutes"
: unit === "y"
? "year"
: unit;
return isText ? `Every ${value} ${unitText}` : `Every ${value} ${unitText}`;
}
}
Expand Down Expand Up @@ -352,7 +352,7 @@ export const getCippFormatting = (data, cellName, type, canReceive, flatten = tr
icon: icon,
key: key,
};
})
}),
);
} else {
// Handle null/undefined single element
Expand Down Expand Up @@ -459,7 +459,7 @@ export const getCippFormatting = (data, cellName, type, canReceive, flatten = tr
: renderChipList(
data
.filter((item) => item)
.map((item) => (typeof item === "object" && item?.label ? item.label : item))
.map((item) => (typeof item === "object" && item?.label ? item.label : item)),
);
}
}
Expand Down Expand Up @@ -500,12 +500,12 @@ export const getCippFormatting = (data, cellName, type, canReceive, flatten = tr
normalized === "enabled"
? "Enabled"
: normalized === "disabled"
? "Disabled"
: normalized === "enabledforreportingbutnotenforced" ||
normalized === "report-only" ||
normalized === "reportonly"
? "Report Only"
: data.charAt(0).toUpperCase() + data.slice(1);
? "Disabled"
: normalized === "enabledforreportingbutnotenforced" ||
normalized === "report-only" ||
normalized === "reportonly"
? "Report Only"
: data.charAt(0).toUpperCase() + data.slice(1);

if (isText) {
return label;
Expand Down Expand Up @@ -561,8 +561,8 @@ export const getCippFormatting = (data, cellName, type, canReceive, flatten = tr
const accessRights = Array.isArray(data)
? data.flatMap((item) => (typeof item === "string" ? item.split(", ") : []))
: typeof data === "string"
? data.split(", ")
: [];
? data.split(", ")
: [];
return isText ? accessRights.join(", ") : renderChipList(accessRights);
}

Expand Down Expand Up @@ -643,8 +643,37 @@ export const getCippFormatting = (data, cellName, type, canReceive, flatten = tr
? translatedLicenses.join(", ")
: translatedLicenses
: Array.isArray(translatedLicenses)
? renderChipList(translatedLicenses)
: translatedLicenses;
? renderChipList(translatedLicenses)
: translatedLicenses;
}

// Handle license assignment states
if (cellName === "licenseAssignmentStates") {
if (!Array.isArray(data) || data.length === 0) {
return [];
}

// Transform the array to replace skuId with translated name and remove disabledPlans
const transformedData = data.map((license) => {
const translatedLicense = getCippLicenseTranslation([license]);
const licenseName = Array.isArray(translatedLicense)
? translatedLicense[0]
: translatedLicense;

// Return new object with skuId replaced by License and without disabledPlans
const { skuId, disabledPlans, ...rest } = license;
return {
License: licenseName,
...rest,
};
});

// Render as a table
return isText ? (
JSON.stringify(transformedData)
) : (
<CippDataTableButton data={transformedData} tableTitle="License Assignment States" />
);
}

if (cellName === "unifiedRoles") {
Expand Down Expand Up @@ -849,7 +878,7 @@ export const getCippFormatting = (data, cellName, type, canReceive, flatten = tr
},
{
fallbackLocale: "en",
}
},
);
const duration = isoDuration(data);
return duration.humanize("en");
Expand Down Expand Up @@ -904,7 +933,7 @@ export const getCippFormatting = (data, cellName, type, canReceive, flatten = tr
return {
label: item.label,
};
})
}),
);
}

Expand Down