Skip to content

Commit 404efd2

Browse files
authored
Fixed Users tab permissions to hide if CreateUser only User permission (#2426)
1 parent fc7d60e commit 404efd2

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

portal-ui/src/common/SecureComponent/permissions.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,21 @@ export const enableUserPermissions = [IAM_SCOPES.ADMIN_ENABLE_USER];
461461

462462
export const disableUserPermissions = [IAM_SCOPES.ADMIN_DISABLE_USER];
463463

464+
//note that adminUserPermissions does NOT include ADMIN_CREATE_USER to allow hiding the Users tab for users wtih only this permission as it is being applied by default
465+
export const adminUserPermissions = [
466+
IAM_SCOPES.ADMIN_LIST_USER_POLICIES,
467+
IAM_SCOPES.ADMIN_LIST_USERS,
468+
IAM_SCOPES.ADMIN_ADD_USER_TO_GROUP,
469+
IAM_SCOPES.ADMIN_REMOVE_USER_FROM_GROUP,
470+
IAM_SCOPES.ADMIN_ATTACH_USER_OR_GROUP_POLICY,
471+
IAM_SCOPES.ADMIN_LIST_USERS,
472+
IAM_SCOPES.ADMIN_DELETE_USER,
473+
IAM_SCOPES.ADMIN_ENABLE_USER,
474+
IAM_SCOPES.ADMIN_DISABLE_USER,
475+
IAM_SCOPES.ADMIN_GET_USER,
476+
IAM_SCOPES.ADMIN_LIST_USER_POLICIES,
477+
];
478+
464479
export const assignIAMPolicyPermissions = [
465480
IAM_SCOPES.ADMIN_ATTACH_USER_OR_GROUP_POLICY,
466481
IAM_SCOPES.ADMIN_LIST_USER_POLICIES,

portal-ui/src/screens/Console/valid-routes.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import { IMenuItem } from "./Menu/types";
1818
import { NavLink } from "react-router-dom";
1919
import {
20+
adminUserPermissions,
2021
CONSOLE_UI_RESOURCE,
2122
IAM_PAGES,
2223
IAM_PAGES_PERMISSIONS,
@@ -85,8 +86,9 @@ export const validRoutes = (
8586
id: "users",
8687
to: IAM_PAGES.USERS,
8788
customPermissionFnc: () =>
88-
hasPermission(CONSOLE_UI_RESOURCE, [IAM_SCOPES.ADMIN_LIST_USERS]) ||
89-
hasPermission(S3_ALL_RESOURCES, [IAM_SCOPES.ADMIN_CREATE_USER]),
89+
hasPermission(CONSOLE_UI_RESOURCE, adminUserPermissions) ||
90+
hasPermission(S3_ALL_RESOURCES, adminUserPermissions) ||
91+
hasPermission(CONSOLE_UI_RESOURCE, [IAM_SCOPES.ADMIN_ALL_ACTIONS]),
9092
name: "Users",
9193
icon: UsersMenuIcon,
9294
fsHidden: ldapIsEnabled,

0 commit comments

Comments
 (0)