|
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