Skip to content

Commit fa72deb

Browse files
author
rvdwegen
committed
Bulk user property wizard #1
1 parent 81bd56b commit fa72deb

File tree

3 files changed

+648
-113
lines changed

3 files changed

+648
-113
lines changed

src/components/CippComponents/CippUserActions.jsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
PhonelinkLock,
1818
PhonelinkSetup,
1919
Shortcut,
20+
EditAttributes,
2021
} from "@mui/icons-material";
2122
import { getCippLicenseTranslation } from "../../utils/get-cipp-license-translation";
2223
import { useSettings } from "/src/hooks/use-settings.js";
@@ -456,6 +457,28 @@ export const CippUserActions = () => {
456457
multiPost: false,
457458
condition: () => canWriteUser,
458459
},
460+
{
461+
label: "Patch Users",
462+
icon: <EditAttributes />,
463+
multiPost: true,
464+
noConfirm: true,
465+
customFunction: (users, action, formData) => {
466+
// Handle both single user and multiple users
467+
const userData = Array.isArray(users) ? users : [users];
468+
469+
// Store users in session storage to avoid URL length limits
470+
sessionStorage.setItem('patchWizardUsers', JSON.stringify(userData));
471+
472+
// Use Next.js router for internal navigation
473+
import('next/router').then(({ default: router }) => {
474+
router.push('/identity/administration/users/patch-wizard');
475+
}).catch(() => {
476+
// Fallback to window.location if router is not available
477+
window.location.href = '/identity/administration/users/patch-wizard';
478+
});
479+
},
480+
condition: () => canWriteUser,
481+
},
459482
];
460483
};
461484

Lines changed: 113 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,113 +1,113 @@
1-
import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx";
2-
import { Layout as DashboardLayout } from "/src/layouts/index.js";
3-
import { Send, GroupAdd, PersonAdd } from "@mui/icons-material";
4-
import Link from "next/link";
5-
import { useSettings } from "/src/hooks/use-settings.js";
6-
import { PermissionButton } from "../../../../utils/permissions";
7-
import { CippUserActions } from "/src/components/CippComponents/CippUserActions.jsx";
8-
9-
const Page = () => {
10-
const pageTitle = "Users";
11-
const tenant = useSettings().currentTenant;
12-
const cardButtonPermissions = ["Identity.User.ReadWrite"];
13-
14-
const filters = [
15-
{
16-
filterName: "Account Enabled",
17-
value: [{ id: "accountEnabled", value: "Yes" }],
18-
type: "column",
19-
},
20-
{
21-
filterName: "Account Disabled",
22-
value: [{ id: "accountEnabled", value: "No" }],
23-
type: "column",
24-
},
25-
{
26-
filterName: "Guest Accounts",
27-
value: [{ id: "userType", value: "Guest" }],
28-
type: "column",
29-
},
30-
];
31-
32-
const offCanvas = {
33-
extendedInfoFields: [
34-
"createdDateTime", // Created Date (UTC)
35-
"id", // Unique ID
36-
"userPrincipalName", // UPN
37-
"givenName", // Given Name
38-
"surname", // Surname
39-
"jobTitle", // Job Title
40-
"assignedLicenses", // Licenses
41-
"businessPhones", // Business Phone
42-
"mobilePhone", // Mobile Phone
43-
"mail", // Mail
44-
"city", // City
45-
"department", // Department
46-
"onPremisesLastSyncDateTime", // OnPrem Last Sync
47-
"onPremisesDistinguishedName", // OnPrem DN
48-
"otherMails", // Alternate Email Addresses
49-
],
50-
actions: CippUserActions(),
51-
};
52-
53-
return (
54-
<CippTablePage
55-
title={pageTitle}
56-
apiUrl="/api/ListGraphRequest"
57-
cardButton={
58-
<>
59-
<PermissionButton
60-
requiredPermissions={cardButtonPermissions}
61-
component={Link}
62-
href="users/add"
63-
startIcon={<PersonAdd />}
64-
>
65-
Add User
66-
</PermissionButton>
67-
<PermissionButton
68-
requiredPermissions={cardButtonPermissions}
69-
component={Link}
70-
href="users/bulk-add"
71-
startIcon={<GroupAdd />}
72-
>
73-
Bulk Add Users
74-
</PermissionButton>
75-
<PermissionButton
76-
requiredPermissions={cardButtonPermissions}
77-
component={Link}
78-
href="users/invite"
79-
startIcon={<Send />}
80-
>
81-
Invite Guest
82-
</PermissionButton>
83-
</>
84-
}
85-
apiData={{
86-
Endpoint: "users",
87-
manualPagination: true,
88-
$select:
89-
"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",
90-
$count: true,
91-
$orderby: "displayName",
92-
$top: 999,
93-
}}
94-
apiDataKey="Results"
95-
actions={CippUserActions()}
96-
offCanvas={offCanvas}
97-
simpleColumns={[
98-
"accountEnabled",
99-
"userPrincipalName",
100-
"displayName",
101-
"mail",
102-
"businessPhones",
103-
"proxyAddresses",
104-
"assignedLicenses",
105-
]}
106-
filters={filters}
107-
/>
108-
);
109-
};
110-
111-
Page.getLayout = (page) => <DashboardLayout>{page}</DashboardLayout>;
112-
113-
export default Page;
1+
import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx";
2+
import { Layout as DashboardLayout } from "/src/layouts/index.js";
3+
import { Send, GroupAdd, PersonAdd } from "@mui/icons-material";
4+
import Link from "next/link";
5+
import { useSettings } from "/src/hooks/use-settings.js";
6+
import { PermissionButton } from "../../../../utils/permissions";
7+
import { CippUserActions } from "/src/components/CippComponents/CippUserActions.jsx";
8+
9+
const Page = () => {
10+
const pageTitle = "Users";
11+
const tenant = useSettings().currentTenant;
12+
const cardButtonPermissions = ["Identity.User.ReadWrite"];
13+
14+
const filters = [
15+
{
16+
filterName: "Account Enabled",
17+
value: [{ id: "accountEnabled", value: "Yes" }],
18+
type: "column",
19+
},
20+
{
21+
filterName: "Account Disabled",
22+
value: [{ id: "accountEnabled", value: "No" }],
23+
type: "column",
24+
},
25+
{
26+
filterName: "Guest Accounts",
27+
value: [{ id: "userType", value: "Guest" }],
28+
type: "column",
29+
},
30+
];
31+
32+
const offCanvas = {
33+
extendedInfoFields: [
34+
"createdDateTime", // Created Date (UTC)
35+
"id", // Unique ID
36+
"userPrincipalName", // UPN
37+
"givenName", // Given Name
38+
"surname", // Surname
39+
"jobTitle", // Job Title
40+
"assignedLicenses", // Licenses
41+
"businessPhones", // Business Phone
42+
"mobilePhone", // Mobile Phone
43+
"mail", // Mail
44+
"city", // City
45+
"department", // Department
46+
"onPremisesLastSyncDateTime", // OnPrem Last Sync
47+
"onPremisesDistinguishedName", // OnPrem DN
48+
"otherMails", // Alternate Email Addresses
49+
],
50+
actions: CippUserActions(),
51+
};
52+
53+
return (
54+
<CippTablePage
55+
title={pageTitle}
56+
apiUrl="/api/ListGraphRequest"
57+
cardButton={
58+
<>
59+
<PermissionButton
60+
requiredPermissions={cardButtonPermissions}
61+
component={Link}
62+
href="users/add"
63+
startIcon={<PersonAdd />}
64+
>
65+
Add User
66+
</PermissionButton>
67+
<PermissionButton
68+
requiredPermissions={cardButtonPermissions}
69+
component={Link}
70+
href="users/bulk-add"
71+
startIcon={<GroupAdd />}
72+
>
73+
Bulk Add Users
74+
</PermissionButton>
75+
<PermissionButton
76+
requiredPermissions={cardButtonPermissions}
77+
component={Link}
78+
href="users/invite"
79+
startIcon={<Send />}
80+
>
81+
Invite Guest
82+
</PermissionButton>
83+
</>
84+
}
85+
apiData={{
86+
Endpoint: "users",
87+
manualPagination: true,
88+
$select:
89+
"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",
90+
$count: true,
91+
$orderby: "displayName",
92+
$top: 999,
93+
}}
94+
apiDataKey="Results"
95+
actions={CippUserActions()}
96+
offCanvas={offCanvas}
97+
simpleColumns={[
98+
"accountEnabled",
99+
"userPrincipalName",
100+
"displayName",
101+
"mail",
102+
"businessPhones",
103+
"proxyAddresses",
104+
"assignedLicenses",
105+
]}
106+
filters={filters}
107+
/>
108+
);
109+
};
110+
111+
Page.getLayout = (page) => <DashboardLayout>{page}</DashboardLayout>;
112+
113+
export default Page;

0 commit comments

Comments
 (0)