diff --git a/frontend/src/component/admin/users/UsersList/UsersActionsCell/UsersActionsCell.tsx b/frontend/src/component/admin/users/UsersList/UsersActionsCell/UsersActionsCell.tsx index 7e5ae338f6..6e5a5043a2 100644 --- a/frontend/src/component/admin/users/UsersList/UsersActionsCell/UsersActionsCell.tsx +++ b/frontend/src/component/admin/users/UsersList/UsersActionsCell/UsersActionsCell.tsx @@ -20,6 +20,7 @@ interface IUsersActionsCellProps { onChangePassword: (event: React.SyntheticEvent) => void; onResetPassword: (event: React.SyntheticEvent) => void; onDelete: (event: React.SyntheticEvent) => void; + scimEnabled?: boolean; } export const UsersActionsCell: VFC = ({ @@ -28,7 +29,11 @@ export const UsersActionsCell: VFC = ({ onChangePassword, onResetPassword, onDelete, + scimEnabled, }) => { + const scimTooltip = + 'This user is managed by your SCIM provider and cannot be changed manually'; + return ( = ({ onClick={onEdit} permission={ADMIN} tooltipProps={{ - title: 'Edit user', + title: scimEnabled ? scimTooltip : 'Edit user', }} + disabled={scimEnabled} > @@ -63,8 +69,9 @@ export const UsersActionsCell: VFC = ({ onClick={onChangePassword} permission={ADMIN} tooltipProps={{ - title: 'Change password', + title: scimEnabled ? scimTooltip : 'Change password', }} + disabled={scimEnabled} > @@ -73,8 +80,9 @@ export const UsersActionsCell: VFC = ({ onClick={onResetPassword} permission={ADMIN} tooltipProps={{ - title: 'Reset password', + title: scimEnabled ? scimTooltip : 'Reset password', }} + disabled={scimEnabled} > @@ -83,8 +91,9 @@ export const UsersActionsCell: VFC = ({ onClick={onDelete} permission={ADMIN} tooltipProps={{ - title: 'Remove user', + title: scimEnabled ? scimTooltip : 'Remove user', }} + disabled={scimEnabled} > diff --git a/frontend/src/component/admin/users/UsersList/UsersList.tsx b/frontend/src/component/admin/users/UsersList/UsersList.tsx index d945fc2631..5fc10628fc 100644 --- a/frontend/src/component/admin/users/UsersList/UsersList.tsx +++ b/frontend/src/component/admin/users/UsersList/UsersList.tsx @@ -38,6 +38,7 @@ import Download from '@mui/icons-material/Download'; import { StyledUsersLinkDiv } from '../Users.styles'; import { useUiFlag } from 'hooks/useUiFlag'; import useUiConfig from '../../../../hooks/api/getters/useUiConfig/useUiConfig'; +import { useScimSettings } from 'hooks/api/getters/useScimSettings/useScimSettings'; const UsersList = () => { const navigate = useNavigate(); @@ -56,6 +57,11 @@ const UsersList = () => { open: false, }); const userAccessUIEnabled = useUiFlag('userAccessUIEnabled'); + const { + settings: { enabled: scimSettingEnabled }, + } = useScimSettings(); + const scimFlagEnabled = useUiFlag('scimApi'); + const scimEnabled = isEnterprise() && scimSettingEnabled && scimFlagEnabled; const [delDialog, setDelDialog] = useState(false); const [showConfirm, setShowConfirm] = useState(false); const [emailSent, setEmailSent] = useState(false); @@ -193,7 +199,9 @@ const UsersList = () => { Header: 'Actions', id: 'Actions', align: 'center', - Cell: ({ row: { original: user } }: any) => ( + Cell: ({ + row: { original: user }, + }: { row: { original: IUser } }) => ( { navigate(`/admin/users/${user.id}/edit`); @@ -210,6 +218,7 @@ const UsersList = () => { onChangePassword={openPwDialog(user)} onResetPassword={openResetPwDialog(user)} onDelete={openDelDialog(user)} + scimEnabled={scimEnabled && Boolean(user.scimId)} /> ), width: userAccessUIEnabled ? 240 : 200, diff --git a/frontend/src/interfaces/user.ts b/frontend/src/interfaces/user.ts index 2dcf71e8b5..764717ffce 100644 --- a/frontend/src/interfaces/user.ts +++ b/frontend/src/interfaces/user.ts @@ -17,6 +17,7 @@ export interface IUser { paid?: boolean; addedAt?: string; accountType?: AccountType; + scimId?: string; } export interface IPermission {