Skip to content

Commit

Permalink
Fix bulk deleting roles without permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
sobrinho committed Mar 25, 2020
1 parent 94b3550 commit 84298d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@
- server: add 'ID' to default scalars in custom types (fix #4061)
- console: add design system base components (#3866)
- docs: add docs for redeliver_event API
- console: fix bulk deleting roles without permissions (#4193)
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ class Permissions extends Component {
};

const getPermissionsTableBody = () => {
const rolePermissions = getTablePermissionsByRoles(tableSchema);

const getBulkCheckbox = (role, isNewRole) => {
const dispatchBulkSelect = e => {
const isChecked = e.target.checked;
Expand All @@ -294,7 +296,10 @@ class Permissions extends Component {
};

return {
showCheckbox: !(role === 'admin' || isNewRole),
showCheckbox:
role !== 'admin' &&
!isNewRole &&
Object.keys(rolePermissions).includes(role),
bulkSelect: permissionsState.bulkSelect,
onChange: dispatchBulkSelect,
role,
Expand Down Expand Up @@ -335,8 +340,6 @@ class Permissions extends Component {
const getRoleQueryPermission = queryType => {
let _permission;

const rolePermissions = getTablePermissionsByRoles(tableSchema);

if (role === 'admin') {
_permission = permissionsSymbols.fullAccess;
} else if (!Object.keys(rolePermissions).includes(role)) {
Expand Down

0 comments on commit 84298d4

Please sign in to comment.