From 1a9b676bc48d86d76159315ab4596728cf1ae2cb Mon Sep 17 00:00:00 2001 From: Pavindu Lakshan Date: Mon, 6 May 2024 10:27:37 +0530 Subject: [PATCH 1/4] Unify admin role view --- .../components/guests/edit-guest-user.tsx | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/features/admin.extensions.v1/components/administrators/components/guests/edit-guest-user.tsx b/features/admin.extensions.v1/components/administrators/components/guests/edit-guest-user.tsx index 2c901f976d1..be3c34f1c2a 100644 --- a/features/admin.extensions.v1/components/administrators/components/guests/edit-guest-user.tsx +++ b/features/admin.extensions.v1/components/administrators/components/guests/edit-guest-user.tsx @@ -26,7 +26,7 @@ import { useTranslation } from "react-i18next"; import { useDispatch, useSelector } from "react-redux"; import { Dispatch } from "redux"; import { Divider, Grid } from "semantic-ui-react"; -import { UserRolesList } from "./user-roles-edit"; +import { UserRolesList } from "../../../../../admin.users.v1/components/user-roles-list" import { AppConstants } from "../../../../../admin.core.v1/constants"; import { FeatureConfigInterface } from "../../../../../admin.core.v1/models"; import { AppState } from "../../../../../admin.core.v1/store"; @@ -194,21 +194,7 @@ export const EditGuestUser: FunctionComponent = ( menuItem: t("users:editUser.tab.menuItems.2"), render: () => ( - + ) } From 66d927c6c19200543ca59d83480c5ce10ec514c8 Mon Sep 17 00:00:00 2001 From: Pavindu Lakshan Date: Mon, 6 May 2024 10:28:05 +0530 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=A6=8B=20Add=20changeset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/sweet-ghosts-sort.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/sweet-ghosts-sort.md diff --git a/.changeset/sweet-ghosts-sort.md b/.changeset/sweet-ghosts-sort.md new file mode 100644 index 00000000000..c0b3a0fb872 --- /dev/null +++ b/.changeset/sweet-ghosts-sort.md @@ -0,0 +1,5 @@ +--- +"@wso2is/features": patch +--- + +Unify admin role view From 8fca04d4ee9262ab86f97065569895b356f62c30 Mon Sep 17 00:00:00 2001 From: Pavindu Lakshan Date: Mon, 6 May 2024 11:03:51 +0530 Subject: [PATCH 3/4] Fix eslint warnings --- .../administrators/components/guests/edit-guest-user.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/features/admin.extensions.v1/components/administrators/components/guests/edit-guest-user.tsx b/features/admin.extensions.v1/components/administrators/components/guests/edit-guest-user.tsx index be3c34f1c2a..1e9551655a2 100644 --- a/features/admin.extensions.v1/components/administrators/components/guests/edit-guest-user.tsx +++ b/features/admin.extensions.v1/components/administrators/components/guests/edit-guest-user.tsx @@ -26,18 +26,16 @@ import { useTranslation } from "react-i18next"; import { useDispatch, useSelector } from "react-redux"; import { Dispatch } from "redux"; import { Divider, Grid } from "semantic-ui-react"; -import { UserRolesList } from "../../../../../admin.users.v1/components/user-roles-list" -import { AppConstants } from "../../../../../admin.core.v1/constants"; import { FeatureConfigInterface } from "../../../../../admin.core.v1/models"; import { AppState } from "../../../../../admin.core.v1/store"; import { ConnectorPropertyInterface, RealmConfigInterface } from "../../../../../admin.server-configurations.v1/models"; import { UserProfile } from "../../../../../admin.users.v1/components/user-profile"; +import { UserRolesList } from "../../../../../admin.users.v1/components/user-roles-list"; import { UserSessions } from "../../../../../admin.users.v1/components/user-sessions"; import { UserManagementConstants } from "../../../../../admin.users.v1/constants/user-management-constants"; import { UserManagementUtils } from "../../../../../admin.users.v1/utils/user-management-utils"; import { administratorConfig } from "../../../../configs/administrator"; import { SCIMConfigs } from "../../../../configs/scim"; -import { hiddenPermissions } from "../../../roles/meta"; import { AdminAccountTypes } from "../../constants"; interface EditGuestUserPropsInterface extends SBACInterface { @@ -90,8 +88,6 @@ export const EditGuestUser: FunctionComponent = ( const dispatch: Dispatch = useDispatch(); const allowedScopes: string = useSelector((state: AppState) => state?.auth?.allowedScopes); - const isGroupAndRoleSeparationEnabled: boolean = useSelector( - (state: AppState) => state?.config?.ui?.isGroupAndRoleSeparationEnabled); const [ isReadOnly, setReadOnly ] = useState(false); const [ allowDeleteOnly, setAllowDeleteOnly ] = useState(false); From 22f236f597892b925bae0533373462bc1a64ff46 Mon Sep 17 00:00:00 2001 From: Pavindu Lakshan Date: Wed, 8 May 2024 08:19:29 +0530 Subject: [PATCH 4/4] Show the old roles list for legacy authz runtime --- .../components/guests/edit-guest-user.tsx | 28 ++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/features/admin.extensions.v1/components/administrators/components/guests/edit-guest-user.tsx b/features/admin.extensions.v1/components/administrators/components/guests/edit-guest-user.tsx index 1e9551655a2..433b39d8147 100644 --- a/features/admin.extensions.v1/components/administrators/components/guests/edit-guest-user.tsx +++ b/features/admin.extensions.v1/components/administrators/components/guests/edit-guest-user.tsx @@ -21,11 +21,14 @@ import { hasRequiredScopes, isFeatureEnabled } from "@wso2is/core/helpers"; import { AlertInterface, ProfileInfoInterface, SBACInterface } from "@wso2is/core/models"; import { addAlert } from "@wso2is/core/store"; import { ContentLoader, Message, ResourceTab } from "@wso2is/react-components"; +import useAuthorization from "features/admin.authorization.v1/hooks/use-authorization"; import React, { FunctionComponent, useEffect, useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import { useDispatch, useSelector } from "react-redux"; import { Dispatch } from "redux"; import { Divider, Grid } from "semantic-ui-react"; +import { UserRolesList as LegacyUserRolesList } from "./user-roles-edit"; +import { AppConstants } from "../../../../../admin.core.v1/constants"; import { FeatureConfigInterface } from "../../../../../admin.core.v1/models"; import { AppState } from "../../../../../admin.core.v1/store"; import { ConnectorPropertyInterface, RealmConfigInterface } from "../../../../../admin.server-configurations.v1/models"; @@ -36,6 +39,7 @@ import { UserManagementConstants } from "../../../../../admin.users.v1/constants import { UserManagementUtils } from "../../../../../admin.users.v1/utils/user-management-utils"; import { administratorConfig } from "../../../../configs/administrator"; import { SCIMConfigs } from "../../../../configs/scim"; +import { hiddenPermissions } from "../../../roles/meta"; import { AdminAccountTypes } from "../../constants"; interface EditGuestUserPropsInterface extends SBACInterface { @@ -86,8 +90,11 @@ export const EditGuestUser: FunctionComponent = ( const { t } = useTranslation(); const dispatch: Dispatch = useDispatch(); + const { legacyAuthzRuntime } = useAuthorization(); const allowedScopes: string = useSelector((state: AppState) => state?.auth?.allowedScopes); + const isGroupAndRoleSeparationEnabled: boolean = useSelector( + (state: AppState) => state?.config?.ui?.isGroupAndRoleSeparationEnabled); const [ isReadOnly, setReadOnly ] = useState(false); const [ allowDeleteOnly, setAllowDeleteOnly ] = useState(false); @@ -190,7 +197,26 @@ export const EditGuestUser: FunctionComponent = ( menuItem: t("users:editUser.tab.menuItems.2"), render: () => ( - + { legacyAuthzRuntime ? + () + : } + + + ) }