diff --git a/lib/permission/permission.js b/lib/permission/permission.js index 3aa85f9c..4d6a9427 100644 --- a/lib/permission/permission.js +++ b/lib/permission/permission.js @@ -32,7 +32,7 @@ class Permission extends BigBitfield { // If perm has no "parent" bit, or current user has the parent permission, set each bit based on the form input const allowedParent = !Metadata[bit].parent || editorPermission.get(Metadata[bit].parent); - if (allowedParent) { + if (allowedParent && !Metadata[bit].block) { this.set(parseInt(bit), (body[`permission_bit_${bit}`] != null)); } } diff --git a/lib/permission/permissions.js b/lib/permission/permissions.js index 6f3c6ed8..0a1aaefc 100644 --- a/lib/permission/permissions.js +++ b/lib/permission/permissions.js @@ -76,7 +76,7 @@ const Metadata = Object.seal(Object.freeze(Object.preventExtensions({ [Permissions.MANAGE_GLOBAL_ROLES]: { label: 'Roles', desc: 'Access roles list. Ability to edit roles', parent: Permissions.ROOT }, [Permissions.MANAGE_BOARD_OWNER]: { title: 'Board Management', subtitle: 'Note: Setting board management permissions on an account/role level will grant them globally i.e for all boards.\nTo make somebody a normal board owner/staff, transfer them the board or give them the appropriate permissions in the board staff permission editing interface.', label: 'Board Owner', desc: 'Full control of the board, equivalent to the BO. Can delete and/or transfer the board. Can only be given by somebody else with "Board Owner" permission. Use with caution!', parent: Permissions.MANAGE_BOARD_OWNER }, - [Permissions.MANAGE_BOARD_GENERAL]: { label: 'Board Staff', desc: 'General board staff permission. Access mod index, catalog, recent posts and reports. Ability to submit mod actions. Bypass board-specific bans and post filters.' }, + [Permissions.MANAGE_BOARD_GENERAL]: { label: 'Board Staff', desc: 'General board staff permission. Access mod index, catalog, recent posts and reports. Ability to submit mod actions. Bypass board-specific bans and post filters.', block: true }, [Permissions.MANAGE_BOARD_BANS]: { label: 'Bans', desc: 'Access board bans. Ability to unban, edit, or deny appeals.' }, [Permissions.MANAGE_BOARD_LOGS]: { label: 'Logs', desc: 'Access board logs. Ability to search/filter.' }, [Permissions.MANAGE_BOARD_SETTINGS]: { label: 'Settings', desc: 'Access board settings. Ability to change any settings. Settings page will show transfer/delete forms for those with "Board Owner" permission.' }, diff --git a/views/includes/globalpermissionsform.pug b/views/includes/globalpermissionsform.pug index f26b22c0..5e7c69ed 100644 --- a/views/includes/globalpermissionsform.pug +++ b/views/includes/globalpermissionsform.pug @@ -5,10 +5,10 @@ for bit, index in Object.keys(jsonPermissions) if jsonPermissions[bit].subtitle p #{jsonPermissions[bit].subtitle} .row - - const hasParent = jsonPermissions[bit].parent == null || permissions.get(jsonPermissions[bit].parent); - - const parentLabel = !hasParent ? jsonPermissions[jsonPermissions[bit].parent].label : ''; - label.postform-style.ph-5(class=(!hasParent ? 'notallowed' : null) title=(!hasParent ? `Requires permission "${parentLabel}"` : null)) - input(type='checkbox' name=`permission_bit_${bit}` value=bit checked=jsonPermissions[bit].state disabled=!hasParent) + - const parentAllowed = jsonPermissions[bit].parent == null || permissions.get(jsonPermissions[bit].parent); + - const parentLabel = !parentAllowed ? jsonPermissions[jsonPermissions[bit].parent].label : ''; + label.postform-style.ph-5(class=(!parentAllowed ? 'notallowed' : null) title=(!parentAllowed ? `Requires permission "${parentLabel}"` : null)) + input(type='checkbox' name=`permission_bit_${bit}` value=bit checked=jsonPermissions[bit].state disabled=(!parentAllowed || jsonPermissions[bit].block)) .rlabel #{jsonPermissions[bit].label} p #{jsonPermissions[bit].desc} input(type='submit', value='Save') diff --git a/views/pages/editstaff.pug b/views/pages/editstaff.pug index b1449301..a90407b2 100644 --- a/views/pages/editstaff.pug +++ b/views/pages/editstaff.pug @@ -28,10 +28,10 @@ block content if jsonPermissions[bit].subtitle p #{jsonPermissions[bit].subtitle} .row - - const hasParent = jsonPermissions[bit].parent == null || permissions.get(jsonPermissions[bit].parent); - - const parentLabel = !hasParent ? jsonPermissions[jsonPermissions[bit].parent].label : ''; - label.postform-style.ph-5(class=(!hasParent ? 'notallowed' : null) title=(!hasParent ? `Requires permission "${parentLabel}"` : null)) - input(type='checkbox' name=`permission_bit_${bit}` value=bit checked=jsonPermissions[bit].state disabled=!hasParent) + - const parentAllowed = jsonPermissions[bit].parent == null || permissions.get(jsonPermissions[bit].parent); + - const parentLabel = !parentAllowed ? jsonPermissions[jsonPermissions[bit].parent].label : ''; + label.postform-style.ph-5(class=(!hasParent ? 'notallowed' : null) title=(!parentAllowed ? `Requires permission "${parentLabel}"` : null)) + input(type='checkbox' name=`permission_bit_${bit}` value=bit checked=jsonPermissions[bit].state disabled=(!parentAllowed || jsonPermissions[bit].block)) .rlabel #{jsonPermissions[bit].label} p #{jsonPermissions[bit].desc} input(type='submit', value='Save')