From 0795f8763dcec61d9b984ada65fdb9692494db10 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 31 May 2020 11:14:31 -0700 Subject: [PATCH] Fix admins being unable to select permissions for subusers; closes #2055 --- .../scripts/components/server/users/EditSubuserModal.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/scripts/components/server/users/EditSubuserModal.tsx b/resources/scripts/components/server/users/EditSubuserModal.tsx index 81fefcc7d..104684f23 100644 --- a/resources/scripts/components/server/users/EditSubuserModal.tsx +++ b/resources/scripts/components/server/users/EditSubuserModal.tsx @@ -53,6 +53,8 @@ const EditSubuserModal = forwardRef(({ subuser, ...pr const [ canEditUser ] = usePermissions(subuser ? [ 'user.update' ] : [ 'user.create' ]); const permissions = useStoreState(state => state.permissions.data); + const user = useStoreState(state => state.user.data!); + // The currently logged in user's permissions. We're going to filter out any permissions // that they should not need. const loggedInPermissions = ServerContext.useStoreState(state => state.server.permissions); @@ -64,7 +66,7 @@ const EditSubuserModal = forwardRef(({ subuser, ...pr const list: string[] = ([] as string[]).concat.apply([], Object.values(cleaned)); - if (loggedInPermissions.length === 1 && loggedInPermissions[0] === '*') { + if (user.rootAdmin || (loggedInPermissions.length === 1 && loggedInPermissions[0] === '*')) { return list; } @@ -81,12 +83,14 @@ const EditSubuserModal = forwardRef(({ subuser, ...pr } + {(!user.rootAdmin && loggedInPermissions[0] !== '*') &&

Only permissions which your account is currently assigned may be selected when creating or modifying other users.

+ } {!subuser &&