From b586d370f074870bf84b751bfbb372b1c92afb91 Mon Sep 17 00:00:00 2001 From: chenos Date: Sun, 10 Apr 2022 21:02:05 +0800 Subject: [PATCH] fix: root role is not displayed --- packages/client/src/acl/ACLProvider.tsx | 2 +- packages/client/src/user/SwitchRole.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/client/src/acl/ACLProvider.tsx b/packages/client/src/acl/ACLProvider.tsx index aba3d634e..5a59407b7 100644 --- a/packages/client/src/acl/ACLProvider.tsx +++ b/packages/client/src/acl/ACLProvider.tsx @@ -26,7 +26,7 @@ export const ACLRolesCheckProvider = (props) => { }, { onSuccess(data) { - if (!data?.data?.allowConfigure) { + if (!data?.data?.allowConfigure && !data?.data?.allowAll) { setDesignable(false); } }, diff --git a/packages/client/src/user/SwitchRole.tsx b/packages/client/src/user/SwitchRole.tsx index 8d851e998..e7d4ed1da 100644 --- a/packages/client/src/user/SwitchRole.tsx +++ b/packages/client/src/user/SwitchRole.tsx @@ -8,7 +8,12 @@ import { useCurrentUserContext } from './CurrentUserProvider'; const useCurrentRoles = () => { const { data } = useCurrentUserContext(); return [ - ...(data?.data?.roles || []), + ...(data?.data?.roles || []).map(item => { + return { + title: item.title, + name: item.name, + } + }), { title: 'Anonymous', name: 'anonymous',