Skip to content

Commit 0f9c9d0

Browse files
committed
claude code feedback - check for user perm in getUsersView()
1 parent 8265942 commit 0f9c9d0

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

packages/components/src/internal/components/user/UsersGridPanel.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export class UsersGridPanelImpl extends PureComponent<Props, State> {
122122

123123
initQueryModel = (usersView: string): void => {
124124
const { actions, container, user } = this.props;
125-
// GitHub Issue 847: is user has manageUsersPermission allow them to select / view all site users
125+
// GitHub Issue 847: if user has manageUsersPermission allow them to select / view all site users
126126
const schemaQuery = usersView === 'site' && user.hasManageUsersPermission() ? SCHEMAS.CORE_TABLES.SITE_USERS : SCHEMAS.CORE_TABLES.USERS;
127127
const baseFilters = usersView === 'all' || usersView === 'site' ? [] : [Filter.create('active', usersView === 'active')];
128128

@@ -144,7 +144,11 @@ export class UsersGridPanelImpl extends PureComponent<Props, State> {
144144
};
145145

146146
getUsersView(paramVal: string): string {
147-
return paramVal === 'inactive' || paramVal === 'all' || paramVal === 'site' ? paramVal : 'active'; // default to view active application users
147+
// only allow 'site' view for user.hasManageUsersPermission()
148+
if (paramVal === 'site' && this.props.user.hasManageUsersPermission()) {
149+
return paramVal;
150+
}
151+
return paramVal === 'inactive' || paramVal === 'all' ? paramVal : 'active'; // default to view active application users
148152
}
149153

150154
getUsersModelId(): string {
@@ -332,7 +336,7 @@ export class UsersGridPanelImpl extends PureComponent<Props, State> {
332336
title = 'Site Users';
333337
}
334338
else if (usersView !== 'all') {
335-
title = capitalizeFirstChar(usersView) + ' Application Users'
339+
title = capitalizeFirstChar(usersView) + ' Application Users';
336340
}
337341

338342
return (

0 commit comments

Comments
 (0)