From 9c968a8952680747c2a95b8b0a4af01d2b6216b7 Mon Sep 17 00:00:00 2001
From: KelvinTegelaar <49186168+KelvinTegelaar@users.noreply.github.com>
Date: Wed, 22 Jan 2025 23:19:35 +0100
Subject: [PATCH 1/5] actionButton
---
src/pages/index.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/pages/index.js b/src/pages/index.js
index 27edd71fbb1e..0c60b06fe5a2 100644
--- a/src/pages/index.js
+++ b/src/pages/index.js
@@ -259,7 +259,7 @@ const Page = () => {
label: "",
value: domain.name,
}))}
- cardButton={
+ actionButton={
organization.data?.verifiedDomains?.length > 3 && (
>
}
- apiUrl="/api/ListGroups"
+ apiUrl="/api/ListGraphRequest"
+ apiData={{
+ Endpoint: "groups",
+ $select:
+ "id,createdDateTime,displayName,description,mail,mailEnabled,mailNickname,resourceProvisioningOptions,securityEnabled,visibility,organizationId,onPremisesSamAccountName,membershipRule,grouptypes,onPremisesSyncEnabled,resourceProvisioningOptions,userPrincipalName,assignedLicenses",
+ $count: true,
+ $orderby: "displayName",
+ $top: 999,
+ manualPagination: true,
+ }}
+ apiDataKey="Results"
actions={actions}
offCanvas={offCanvas}
simpleColumns={[
@@ -115,6 +131,7 @@ const Page = () => {
"mailEnabled",
"mailNickname",
"calculatedGroupType",
+ "assignedLicenses",
"visibility",
"onPremisesSamAccountName",
"membershipRule",
From 273cddefd79d147272e05a6e473ae12d203434e0 Mon Sep 17 00:00:00 2001
From: John Duprey
Date: Wed, 22 Jan 2025 22:05:55 -0500
Subject: [PATCH 5/5] view user improvements
add CippUserActions component
add hideTitle param to CippDataTable
add table option to CippBannerListCard
add group/role membership banner cards to view user
---
.../CippCards/CippBannerListCard.jsx | 38 +-
.../CippComponents/CippUserActions.jsx | 317 ++++++++++++++++
src/components/CippTable/CippDataTable.js | 9 +-
.../identity/administration/users/index.js | 316 +---------------
.../administration/users/user/index.jsx | 356 ++++--------------
5 files changed, 414 insertions(+), 622 deletions(-)
create mode 100644 src/components/CippComponents/CippUserActions.jsx
diff --git a/src/components/CippCards/CippBannerListCard.jsx b/src/components/CippCards/CippBannerListCard.jsx
index 41d3609a1756..a0bab7612a02 100644
--- a/src/components/CippCards/CippBannerListCard.jsx
+++ b/src/components/CippCards/CippBannerListCard.jsx
@@ -13,6 +13,7 @@ import {
} from "@mui/material";
import ChevronDownIcon from "@heroicons/react/24/outline/ChevronDownIcon";
import { CippPropertyListCard } from "./CippPropertyListCard";
+import { CippDataTable } from "../CippTable/CippDataTable";
export const CippBannerListCard = (props) => {
const { items = [], isCollapsible = false, isFetching = false, ...other } = props;
@@ -113,17 +114,19 @@ export const CippBannerListCard = (props) => {
{/* Right Side: Status and Expand Icon */}
-
-
- {item.statusText}
-
+ {item?.statusText && (
+
+
+ {item.statusText}
+
+ )}
{isCollapsible && (
handleExpand(item.id)}>
{
{isCollapsible && (
-
+ {item?.propertyItems?.length > 0 && (
+
+ )}
+ {item?.table && }
)}
diff --git a/src/components/CippComponents/CippUserActions.jsx b/src/components/CippComponents/CippUserActions.jsx
new file mode 100644
index 000000000000..fe532d259f4b
--- /dev/null
+++ b/src/components/CippComponents/CippUserActions.jsx
@@ -0,0 +1,317 @@
+import { EyeIcon, MagnifyingGlassIcon, TrashIcon } from "@heroicons/react/24/outline";
+import {
+ Archive,
+ Block,
+ Clear,
+ CloudDone,
+ Edit,
+ Email,
+ ForwardToInbox,
+ GroupAdd,
+ LockOpen,
+ LockPerson,
+ LockReset,
+ MeetingRoom,
+ NoMeetingRoom,
+ Password,
+ PersonOff,
+ PhonelinkLock,
+ PhonelinkSetup,
+ Shortcut,
+} from "@mui/icons-material";
+import { useSettings } from "/src/hooks/use-settings.js";
+
+export const CippUserActions = () => {
+ const tenant = useSettings().currentTenant;
+ return [
+ {
+ //tested
+ label: "View User",
+ link: "/identity/administration/users/user?userId=[id]",
+ multiPost: false,
+ icon: ,
+ color: "success",
+ },
+ {
+ //tested
+ label: "Edit User",
+ link: "/identity/administration/users/user/edit?userId=[id]",
+ icon: ,
+ color: "success",
+ target: "_self",
+ },
+ {
+ //tested
+ label: "Research Compromised Account",
+ type: "GET",
+ icon: ,
+ link: "/identity/administration/users/user/bec?userId=[id]",
+ confirmText: "Are you sure you want to research this compromised account?",
+ multiPost: false,
+ },
+ {
+ //tested
+
+ label: "Create Temporary Access Password",
+ type: "GET",
+ icon: ,
+ url: "/api/ExecCreateTAP",
+ data: { ID: "userPrincipalName" },
+ confirmText: "Are you sure you want to create a Temporary Access Password?",
+ multiPost: false,
+ },
+ {
+ //tested
+ label: "Re-require MFA registration",
+ type: "GET",
+ icon: ,
+ url: "/api/ExecResetMFA",
+ data: { ID: "userPrincipalName" },
+ confirmText: "Are you sure you want to reset MFA for this user?",
+ multiPost: false,
+ },
+ {
+ //tested
+ label: "Send MFA Push",
+ type: "POST",
+ icon: ,
+ url: "/api/ExecSendPush",
+ data: { UserEmail: "userPrincipalName" },
+ confirmText: "Are you sure you want to send an MFA request?",
+ multiPost: false,
+ },
+ {
+ //tested
+ label: "Set Per-User MFA",
+ type: "POST",
+ icon: ,
+ url: "/api/ExecPerUserMFA",
+ data: { userId: "userPrincipalName" },
+ fields: [
+ {
+ type: "autoComplete",
+ name: "State",
+ label: "State",
+ options: [
+ { label: "Enforced", value: "Enforced" },
+ { label: "Enabled", value: "Enabled" },
+ { label: "Disabled", value: "Disabled" },
+ ],
+ multiple: false,
+ },
+ ],
+ confirmText: "Are you sure you want to set per-user MFA for these users?",
+ multiPost: false,
+ },
+ {
+ //tested
+ label: "Convert to Shared Mailbox",
+ type: "GET",
+ icon: ,
+ url: "/api/ExecConvertToSharedMailbox",
+ data: { ID: "userPrincipalName" },
+ confirmText: "Are you sure you want to convert this user to a shared mailbox?",
+ multiPost: false,
+ },
+ {
+ label: "Convert to User Mailbox",
+ type: "GET",
+ icon: ,
+ url: "/api/ExecConvertToSharedMailbox",
+ data: { ID: "userPrincipalName", ConvertToUser: true },
+ confirmText: "Are you sure you want to convert this user to a user mailbox?",
+ multiPost: false,
+ },
+ {
+ //tested
+ label: "Enable Online Archive",
+ type: "GET",
+ icon: ,
+ url: "/api/ExecEnableArchive",
+ data: { ID: "userPrincipalName" },
+ confirmText: "Are you sure you want to enable the online archive for this user?",
+ multiPost: false,
+ },
+ {
+ //tested
+ label: "Set Out of Office",
+ type: "POST",
+ icon: ,
+ url: "/api/ExecSetOoO",
+ data: {
+ userId: "userPrincipalName",
+ AutoReplyState: { value: "Enabled" },
+ tenantFilter: "Tenant",
+ },
+ fields: [{ type: "richText", name: "input", label: "Out of Office Message" }],
+ confirmText: "Are you sure you want to set the out of office?",
+ multiPost: false,
+ },
+
+ {
+ label: "Disable Out of Office",
+ type: "POST",
+ icon: ,
+ url: "/api/ExecSetOoO",
+ data: { user: "userPrincipalName", AutoReplyState: "Disabled" },
+ confirmText: "Are you sure you want to disable the out of office?",
+ multiPost: false,
+ },
+ {
+ label: "Add to Group",
+ type: "POST",
+ icon: ,
+ url: "/api/EditGroup",
+ data: { addMember: "userPrincipalName" },
+ fields: [
+ {
+ type: "autoComplete",
+ name: "groupId",
+ label: "Select a group to add the user to",
+ multiple: false,
+ creatable: false,
+ api: {
+ url: "/api/ListGroups",
+ labelField: "displayName",
+ valueField: "id",
+ addedField: {
+ groupType: "calculatedGroupType",
+ groupName: "displayName",
+ },
+ queryKey: `groups-${tenant}`,
+ },
+ },
+ ],
+ confirmText: "Are you sure you want to add the user to this group?",
+ },
+ {
+ label: "Disable Email Forwarding",
+ type: "POST",
+ url: "/api/ExecEmailForward",
+ icon: ,
+ data: {
+ username: "userPrincipalName",
+ userid: "userPrincipalName",
+ ForwardOption: "!disabled",
+ },
+ confirmText: "Are you sure you want to disable forwarding of this user's emails?",
+ multiPost: false,
+ },
+ {
+ label: "Pre-provision OneDrive",
+ type: "POST",
+ icon: ,
+ url: "/api/ExecOneDriveProvision",
+ data: { UserPrincipalName: "userPrincipalName" },
+ confirmText: "Are you sure you want to pre-provision OneDrive for this user?",
+ multiPost: false,
+ },
+ {
+ label: "Add OneDrive Shortcut",
+ type: "POST",
+ icon: ,
+ url: "/api/ExecOneDriveShortCut",
+ data: {
+ username: "userPrincipalName",
+ userid: "id",
+ },
+ fields: [
+ {
+ type: "autoComplete",
+ name: "siteUrl",
+ label: "Select a Site",
+ multiple: false,
+ creatable: false,
+ api: {
+ url: "/api/ListSites",
+ data: { type: "SharePointSiteUsage", URLOnly: true },
+ labelField: "webUrl",
+ valueField: "webUrl",
+ queryKey: `sharepointSites-${tenant}`,
+ },
+ },
+ ],
+ confirmText: "Select a SharePoint site to create a shortcut for:",
+ multiPost: false,
+ },
+ {
+ label: "Block Sign In",
+ type: "GET",
+ icon: ,
+ url: "/api/ExecDisableUser",
+ data: { ID: "id" },
+ confirmText: "Are you sure you want to block the sign-in for this user?",
+ multiPost: false,
+ condition: (row) => row.accountEnabled,
+ },
+ {
+ label: "Unblock Sign In",
+ type: "GET",
+ icon: ,
+ url: "/api/ExecDisableUser",
+ data: { ID: "id", Enable: true },
+ confirmText: "Are you sure you want to unblock sign-in for this user?",
+ multiPost: false,
+ condition: (row) => !row.accountEnabled,
+ },
+ {
+ label: "Reset Password (Must Change)",
+ type: "GET",
+ icon: ,
+ url: "/api/ExecResetPass",
+ data: {
+ MustChange: true,
+ ID: "userPrincipalName",
+ displayName: "displayName",
+ },
+ confirmText:
+ "Are you sure you want to reset the password for this user? The user must change their password at next logon.",
+ multiPost: false,
+ },
+ {
+ label: "Reset Password",
+ type: "GET",
+ icon: ,
+ url: "/api/ExecResetPass",
+ data: {
+ MustChange: false,
+ ID: "userPrincipalName",
+ displayName: "displayName",
+ },
+ confirmText: "Are you sure you want to reset the password for this user?",
+ multiPost: false,
+ },
+ {
+ label: "Clear Immutable ID",
+ type: "GET",
+ icon: ,
+ url: "/api/ExecClrImmId",
+ data: {
+ ID: "id",
+ },
+ confirmText: "Are you sure you want to clear the Immutable ID for this user?",
+ multiPost: false,
+ condition: (row) => row.onPremisesSyncEnabled,
+ },
+ {
+ label: "Revoke all user sessions",
+ type: "GET",
+ icon: ,
+ url: "/api/ExecRevokeSessions",
+ data: { ID: "id", Username: "userPrincipalName" },
+ confirmText: "Are you sure you want to revoke all sessions for this user?",
+ multiPost: false,
+ },
+ {
+ label: "Delete User",
+ type: "GET",
+ icon: ,
+ url: "/api/RemoveUser",
+ data: { ID: "id" },
+ confirmText: "Are you sure you want to delete this user?",
+ multiPost: false,
+ },
+ ];
+};
+
+export default CippUserActions;
diff --git a/src/components/CippTable/CippDataTable.js b/src/components/CippTable/CippDataTable.js
index 0eb40ee4d575..6d59e6f372d6 100644
--- a/src/components/CippTable/CippDataTable.js
+++ b/src/components/CippTable/CippDataTable.js
@@ -46,6 +46,7 @@ export const CippDataTable = (props) => {
cardButton,
offCanvas = false,
noCard = false,
+ hideTitle = false,
refreshFunction,
incorrectDataMessage = "Data not in correct format",
onChange,
@@ -298,8 +299,12 @@ export const CippDataTable = (props) => {
) : (
// Render the table inside a Card
-
-
+ {cardButton || !hideTitle ? (
+ <>
+
+
+ >
+ ) : null}
{!Array.isArray(usedData) && usedData ? (
diff --git a/src/pages/identity/administration/users/index.js b/src/pages/identity/administration/users/index.js
index aff8bcf7792a..c03a62bb56cd 100644
--- a/src/pages/identity/administration/users/index.js
+++ b/src/pages/identity/administration/users/index.js
@@ -1,324 +1,14 @@
-import { EyeIcon, MagnifyingGlassIcon, TrashIcon } from "@heroicons/react/24/outline";
import { CippTablePage } from "/src/components/CippComponents/CippTablePage.jsx";
import { Layout as DashboardLayout } from "/src/layouts/index.js";
-import {
- Archive,
- Block,
- Clear,
- CloudDone,
- Edit,
- Email,
- ForwardToInbox,
- GroupAdd,
- LockOpen,
- LockPerson,
- LockReset,
- MeetingRoom,
- NoMeetingRoom,
- Password,
- PersonOff,
- PhonelinkLock,
- PhonelinkSetup,
- Shortcut,
-} from "@mui/icons-material";
import { Button } from "@mui/material";
import Link from "next/link";
import { useSettings } from "/src/hooks/use-settings.js";
+import { CippUserActions } from "/src/components/CippComponents/CippUserActions.jsx";
const Page = () => {
const pageTitle = "Users";
const tenant = useSettings().currentTenant;
- const actions = [
- {
- //tested
- label: "View User",
- link: "/identity/administration/users/user?userId=[id]",
- multiPost: false,
- icon: ,
- color: "success",
- },
- {
- //tested
- label: "Edit User",
- link: "/identity/administration/users/user/edit?userId=[id]",
- icon: ,
- color: "success",
- target: "_self",
- },
- {
- //tested
- label: "Research Compromised Account",
- type: "GET",
- icon: ,
- link: "/identity/administration/users/user/bec?userId=[id]",
- confirmText: "Are you sure you want to research this compromised account?",
- multiPost: false,
- },
- {
- //tested
-
- label: "Create Temporary Access Password",
- type: "GET",
- icon: ,
- url: "/api/ExecCreateTAP",
- data: { ID: "userPrincipalName" },
- confirmText: "Are you sure you want to create a Temporary Access Password?",
- multiPost: false,
- },
- {
- //tested
- label: "Re-require MFA registration",
- type: "GET",
- icon: ,
- url: "/api/ExecResetMFA",
- data: { ID: "userPrincipalName" },
- confirmText: "Are you sure you want to reset MFA for this user?",
- multiPost: false,
- },
- {
- //tested
- label: "Send MFA Push",
- type: "POST",
- icon: ,
- url: "/api/ExecSendPush",
- data: { UserEmail: "userPrincipalName" },
- confirmText: "Are you sure you want to send an MFA request?",
- multiPost: false,
- },
- {
- //tested
- label: "Set Per-User MFA",
- type: "POST",
- icon: ,
- url: "/api/ExecPerUserMFA",
- data: { userId: "userPrincipalName" },
- fields: [
- {
- type: "autoComplete",
- name: "State",
- label: "State",
- options: [
- { label: "Enforced", value: "Enforced" },
- { label: "Enabled", value: "Enabled" },
- { label: "Disabled", value: "Disabled" },
- ],
- multiple: false,
- },
- ],
- confirmText: "Are you sure you want to set per-user MFA for these users?",
- multiPost: false,
- },
- {
- //tested
- label: "Convert to Shared Mailbox",
- type: "GET",
- icon: ,
- url: "/api/ExecConvertToSharedMailbox",
- data: { ID: "userPrincipalName" },
- confirmText: "Are you sure you want to convert this user to a shared mailbox?",
- multiPost: false,
- },
- {
- label: "Convert to User Mailbox",
- type: "GET",
- icon: ,
- url: "/api/ExecConvertToSharedMailbox",
- data: { ID: "userPrincipalName", ConvertToUser: true },
- confirmText: "Are you sure you want to convert this user to a user mailbox?",
- multiPost: false,
- },
- {
- //tested
- label: "Enable Online Archive",
- type: "GET",
- icon: ,
- url: "/api/ExecEnableArchive",
- data: { ID: "userPrincipalName" },
- confirmText: "Are you sure you want to enable the online archive for this user?",
- multiPost: false,
- },
- {
- //tested
- label: "Set Out of Office",
- type: "POST",
- icon: ,
- url: "/api/ExecSetOoO",
- data: {
- userId: "userPrincipalName",
- AutoReplyState: { value: "Enabled" },
- tenantFilter: "Tenant",
- },
- fields: [{ type: "richText", name: "input", label: "Out of Office Message" }],
- confirmText: "Are you sure you want to set the out of office?",
- multiPost: false,
- },
-
- {
- label: "Disable Out of Office",
- type: "POST",
- icon: ,
- url: "/api/ExecSetOoO",
- data: { user: "userPrincipalName", AutoReplyState: "Disabled" },
- confirmText: "Are you sure you want to disable the out of office?",
- multiPost: false,
- },
- {
- label: "Add to Group",
- type: "POST",
- icon: ,
- url: "/api/EditGroup",
- data: { addMember: "userPrincipalName" },
- fields: [
- {
- type: "autoComplete",
- name: "groupId",
- label: "Select a group to add the user to",
- multiple: false,
- creatable: false,
- api: {
- url: "/api/ListGroups",
- labelField: "displayName",
- valueField: "id",
- addedField: {
- groupType: "calculatedGroupType",
- groupName: "displayName",
- },
- queryKey: `groups-${tenant}`,
- },
- },
- ],
- confirmText: "Are you sure you want to add the user to this group?",
- },
- {
- label: "Disable Email Forwarding",
- type: "POST",
- url: "/api/ExecEmailForward",
- icon: ,
- data: {
- username: "userPrincipalName",
- userid: "userPrincipalName",
- ForwardOption: "!disabled",
- },
- confirmText: "Are you sure you want to disable forwarding of this user's emails?",
- multiPost: false,
- },
- {
- label: "Pre-provision OneDrive",
- type: "POST",
- icon: ,
- url: "/api/ExecOneDriveProvision",
- data: { UserPrincipalName: "userPrincipalName" },
- confirmText: "Are you sure you want to pre-provision OneDrive for this user?",
- multiPost: false,
- },
- {
- label: "Add OneDrive Shortcut",
- type: "POST",
- icon: ,
- url: "/api/ExecOneDriveShortCut",
- data: {
- username: "userPrincipalName",
- userid: "id",
- },
- fields: [
- {
- type: "autoComplete",
- name: "siteUrl",
- label: "Select a Site",
- multiple: false,
- creatable: false,
- api: {
- url: "/api/ListSites",
- data: { type: "SharePointSiteUsage", URLOnly: true },
- labelField: "webUrl",
- valueField: "webUrl",
- queryKey: `sharepointSites-${tenant}`,
- },
- },
- ],
- confirmText: "Select a SharePoint site to create a shortcut for:",
- multiPost: false,
- },
- {
- label: "Block Sign In",
- type: "GET",
- icon: ,
- url: "/api/ExecDisableUser",
- data: { ID: "id" },
- confirmText: "Are you sure you want to block the sign-in for this user?",
- multiPost: false,
- condition: (row) => row.accountEnabled,
- },
- {
- label: "Unblock Sign In",
- type: "GET",
- icon: ,
- url: "/api/ExecDisableUser",
- data: { ID: "id", Enable: true },
- confirmText: "Are you sure you want to unblock sign-in for this user?",
- multiPost: false,
- condition: (row) => !row.accountEnabled,
- },
- {
- label: "Reset Password (Must Change)",
- type: "GET",
- icon: ,
- url: "/api/ExecResetPass",
- data: {
- MustChange: true,
- ID: "userPrincipalName",
- displayName: "displayName",
- },
- confirmText:
- "Are you sure you want to reset the password for this user? The user must change their password at next logon.",
- multiPost: false,
- },
- {
- label: "Reset Password",
- type: "GET",
- icon: ,
- url: "/api/ExecResetPass",
- data: {
- MustChange: false,
- ID: "userPrincipalName",
- displayName: "displayName",
- },
- confirmText: "Are you sure you want to reset the password for this user?",
- multiPost: false,
- },
- {
- label: "Clear Immutable ID",
- type: "GET",
- icon: ,
- url: "/api/ExecClrImmId",
- data: {
- ID: "id",
- },
- confirmText: "Are you sure you want to clear the Immutable ID for this user?",
- multiPost: false,
- condition: (row) => row.onPremisesSyncEnabled,
- },
- {
- label: "Revoke all user sessions",
- type: "GET",
- icon: ,
- url: "/api/ExecRevokeSessions",
- data: { ID: "id", Username: "userPrincipalName" },
- confirmText: "Are you sure you want to revoke all sessions for this user?",
- multiPost: false,
- },
- {
- label: "Delete User",
- type: "GET",
- icon: ,
- url: "/api/RemoveUser",
- data: { ID: "id" },
- confirmText: "Are you sure you want to delete this user?",
- multiPost: false,
- },
- ];
-
const offCanvas = {
extendedInfoFields: [
"createdDateTime", // Created Date (UTC)
@@ -336,7 +26,7 @@ const Page = () => {
"id", // Unique ID
"otherMails", // Alternate Email Addresses
],
- actions: actions,
+ actions: CippUserActions(),
};
return (
@@ -366,7 +56,7 @@ const Page = () => {
$top: 999,
}}
apiDataKey="Results"
- actions={actions}
+ actions={CippUserActions()}
offCanvas={offCanvas}
simpleColumns={[
"accountEnabled",
diff --git a/src/pages/identity/administration/users/user/index.jsx b/src/pages/identity/administration/users/user/index.jsx
index 4f0b2bb22ae5..3ed348320120 100644
--- a/src/pages/identity/administration/users/user/index.jsx
+++ b/src/pages/identity/administration/users/user/index.jsx
@@ -4,7 +4,7 @@ import { useRouter } from "next/router";
import { ApiGetCall } from "/src/api/ApiCall";
import CippFormSkeleton from "/src/components/CippFormPages/CippFormSkeleton";
import CalendarIcon from "@heroicons/react/24/outline/CalendarIcon";
-import { Check, Mail } from "@mui/icons-material";
+import { AdminPanelSettings, Check, Group, Mail } from "@mui/icons-material";
import { HeaderedTabbedLayout } from "../../../../../layouts/HeaderedTabbedLayout";
import tabOptions from "./tabOptions";
import { CippCopyToClipBoard } from "../../../../../components/CippComponents/CippCopyToClipboard";
@@ -17,27 +17,7 @@ import { CippTimeAgo } from "../../../../../components/CippComponents/CippTimeAg
import { useEffect, useState } from "react";
import { usePopover } from "../../../../../hooks/use-popover";
import { useDialog } from "../../../../../hooks/use-dialog";
-import { EyeIcon, MagnifyingGlassIcon, TrashIcon } from "@heroicons/react/24/outline";
-import {
- Archive,
- Block,
- Clear,
- CloudDone,
- Edit,
- Email,
- ForwardToInbox,
- GroupAdd,
- LockOpen,
- LockPerson,
- LockReset,
- MeetingRoom,
- NoMeetingRoom,
- Password,
- PersonOff,
- PhonelinkLock,
- PhonelinkSetup,
- Shortcut,
-} from "@mui/icons-material";
+import CippUserActions from "/src/components/CippComponents/CippUserActions";
const Page = () => {
const popover = usePopover();
@@ -51,12 +31,23 @@ const Page = () => {
setWaiting(true);
}
}, [userId]);
+
const userRequest = ApiGetCall({
url: `/api/ListUsers?UserId=${userId}&tenantFilter=${userSettingsDefaults.currentTenant}`,
queryKey: `ListUsers-${userId}`,
waiting: waiting,
});
+ const userMemberOf = ApiGetCall({
+ url: "/api/ListGraphRequest",
+ data: {
+ Endpoint: `/users/${userId}/memberOf`,
+ tenantFilter: userSettingsDefaults.currentTenant,
+ $top: 99,
+ },
+ queryKey: `UserMemberOf-${userId}`,
+ });
+
const MFARequest = ApiGetCall({
url: "/api/ListGraphRequest",
data: {
@@ -356,288 +347,60 @@ const Page = () => {
},
];
}
- const actions = [
- {
- //tested
- label: "View User",
- link: "/identity/administration/users/user?userId=[id]",
- multiPost: false,
- icon: ,
- color: "success",
- },
- {
- //tested
- label: "Edit User",
- link: "/identity/administration/users/user/edit?userId=[id]",
- icon: ,
- color: "success",
- target: "_self",
- },
- {
- //tested
- label: "Research Compromised Account",
- type: "GET",
- icon: ,
- link: "/identity/administration/users/user/bec?userId=[id]",
- confirmText: "Are you sure you want to research this compromised account?",
- multiPost: false,
- },
- {
- //tested
- label: "Create Temporary Access Password",
- type: "GET",
- icon: ,
- url: "/api/ExecCreateTAP",
- data: { ID: "userPrincipalName" },
- confirmText: "Are you sure you want to create a Temporary Access Password?",
- multiPost: false,
- },
- {
- //tested
- label: "Rerequire MFA registration",
- type: "GET",
- icon: ,
- url: "/api/ExecResetMFA",
- data: { ID: "userPrincipalName" },
- confirmText: "Are you sure you want to reset MFA for this user?",
- multiPost: false,
- },
- {
- //tested
- label: "Send MFA Push",
- type: "POST",
- icon: ,
- url: "/api/ExecSendPush",
- data: { UserEmail: "userPrincipalName" },
- confirmText: "Are you sure you want to send an MFA request?",
- multiPost: false,
- },
- {
- //tested
- label: "Set Per-User MFA",
- type: "POST",
- icon: ,
- url: "/api/ExecPerUserMFA",
- data: { userId: "userPrincipalName" },
- fields: [
+ const groupMembershipItems = userMemberOf.isSuccess
+ ? [
{
- type: "autoComplete",
- name: "State",
- label: "State",
- options: [
- { label: "Enforced", value: "Enforced" },
- { label: "Enabled", value: "Enabled" },
- { label: "Disabled", value: "Disabled" },
- ],
- multiple: false,
+ id: 1,
+ cardLabelBox: {
+ cardLabelBoxHeader: ,
+ },
+ text: "Group Memberships",
+ subtext: "List of groups the user is a member of",
+ table: {
+ title: "Group Memberships",
+ hideTitle: true,
+ actions: [
+ {
+ label: "Edit Group",
+ link: "/identity/administration/groups/edit?groupId=[id]",
+ },
+ ],
+ data: userMemberOf?.data?.Results.filter(
+ (item) => item?.["@odata.type"] === "#microsoft.graph.group"
+ ),
+ simpleColumns: ["displayName", "groupTypes", "securityEnabled", "mailEnabled"],
+ },
},
- ],
- confirmText: "Are you sure you want to set per-user MFA for these users?",
- multiPost: false,
- },
- {
- //tested
- label: "Convert to Shared Mailbox",
- type: "GET",
- icon: ,
- url: "/api/ExecConvertToSharedMailbox",
- data: { ID: "userPrincipalName" },
- confirmText: "Are you sure you want to convert this user to a shared mailbox?",
- multiPost: false,
- },
- {
- //tested
- label: "Enable Online Archive",
- type: "GET",
- icon: ,
- url: "/api/ExecEnableArchive",
- data: { ID: "userPrincipalName" },
- confirmText: "Are you sure you want to enable the online archive for this user?",
- multiPost: false,
- },
- {
- //tested
- label: "Set Out of Office",
- type: "POST",
- icon: ,
- url: "/api/ExecSetOoO",
- data: {
- userId: "userPrincipalName",
- AutoReplyState: { value: "Enabled" },
- },
- fields: [{ type: "richText", name: "input", label: "Out of Office Message" }],
- confirmText: "Are you sure you want to set the out of office?",
- multiPost: false,
- },
+ ]
+ : [];
- {
- label: "Disable Out of Office",
- type: "POST",
- icon: ,
- url: "/api/ExecSetOoO",
- data: { user: "userPrincipalName", AutoReplyState: "Disabled" },
- confirmText: "Are you sure you want to disable the out of office?",
- multiPost: false,
- },
- {
- label: "Add to Group",
- type: "POST",
- icon: ,
- url: "/api/EditGroup",
- data: { addMember: "userPrincipalName" },
- fields: [
+ const roleMembershipItems = userMemberOf.isSuccess
+ ? [
{
- type: "autoComplete",
- name: "groupId",
- label: "Select a group to add the user to",
- multiple: false,
- creatable: false,
- api: {
- url: "/api/ListGroups",
- labelField: "displayName",
- valueField: "id",
- addedField: {
- groupType: "calculatedGroupType",
- groupName: "displayName",
- },
- queryKey: `groups-${userSettingsDefaults.currentTenant}}`,
+ id: 1,
+ cardLabelBox: {
+ cardLabelBoxHeader: ,
},
- },
- ],
- confirmText: "Are you sure you want to add the user to this group?",
- },
- {
- label: "Disable Email Forwarding",
- type: "POST",
- url: "/api/ExecEmailForward",
- icon: ,
- data: {
- username: "userPrincipalName",
- userid: "userPrincipalName",
- ForwardOption: "!disabled",
- },
- confirmText: "Are you sure you want to disable forwarding of this user's emails?",
- multiPost: false,
- },
- {
- label: "Pre-provision OneDrive",
- type: "POST",
- icon: ,
- url: "/api/ExecOneDriveProvision",
- data: { UserPrincipalName: "userPrincipalName" },
- confirmText: "Are you sure you want to pre-provision OneDrive for this user?",
- multiPost: false,
- },
- {
- label: "Add OneDrive Shortcut",
- type: "POST",
- icon: ,
- url: "/api/ExecOneDriveShortCut",
- data: {
- username: "userPrincipalName",
- userid: "id",
- },
- fields: [
- {
- type: "autoComplete",
- name: "siteUrl",
- label: "Select a Site",
- multiple: false,
- creatable: false,
- api: {
- url: "/api/ListSites",
- data: { type: "SharePointSiteUsage", URLOnly: true },
- labelField: "webUrl",
- valueField: "webUrl",
- queryKey: `sharepointSites-${userSettingsDefaults.currentTenant}}`,
+ text: "Roles",
+ subtext: "List of roles the user is a member of",
+ table: {
+ title: "Role Memberships",
+ hideTitle: true,
+ data: userMemberOf?.data?.Results.filter(
+ (item) => item?.["@odata.type"] === "#microsoft.graph.directoryRole"
+ ),
+ simpleColumns: ["displayName", "description"],
},
},
- ],
- confirmText: "Select a SharePoint site to create a shortcut for:",
- multiPost: false,
- },
- {
- label: "Block Sign In",
- type: "GET",
- icon: ,
- url: "/api/ExecDisableUser",
- data: { ID: "id" },
- confirmText: "Are you sure you want to block the sign-in for this user?",
- multiPost: false,
- },
- {
- label: "Unblock Sign In",
- type: "GET",
- icon: ,
- url: "/api/ExecDisableUser",
- data: { ID: "id", Enable: true },
- confirmText: "Are you sure you want to unblock sign-in for this user?",
- multiPost: false,
- },
- {
- label: "Reset Password (Must Change)",
- type: "GET",
- icon: ,
- url: "/api/ExecResetPass",
- data: {
- MustChange: true,
- ID: "userPrincipalName",
- displayName: "displayName",
- },
- confirmText:
- "Are you sure you want to reset the password for this user? The user must change their password at next logon.",
- multiPost: false,
- },
- {
- label: "Reset Password",
- type: "GET",
- icon: ,
- url: "/api/ExecResetPass",
- data: {
- MustChange: false,
- ID: "userPrincipalName",
- displayName: "displayName",
- },
- confirmText: "Are you sure you want to reset the password for this user?",
- multiPost: false,
- },
- {
- label: "Clear Immutable ID",
- type: "GET",
- icon: ,
- url: "/api/ExecClrImmId",
- data: {
- ID: "id",
- },
- confirmText: "Are you sure you want to clear the Immutable ID for this user?",
- multiPost: false,
- },
- {
- label: "Revoke all user sessions",
- type: "GET",
- icon: ,
- url: "/api/ExecRevokeSessions",
- data: { ID: "id", Username: "userPrincipalName" },
- confirmText: "Are you sure you want to revoke all sessions for this user?",
- multiPost: false,
- },
- {
- label: "Delete User",
- type: "GET",
- icon: ,
- url: "/api/RemoveUser",
- data: { ID: "id" },
- confirmText: "Are you sure you want to delete this user?",
- multiPost: false,
- },
- ];
+ ]
+ : [];
return (
{
items={mfaDevicesItems}
isCollapsible={mfaDevicesItems.length > 0 ? true : false}
/>
+ Memberships
+ 0 ? true : false}
+ />
+ 0 ? true : false}
+ />