Merge branch 'develop' into feature/396-localisation

indiachan-spamvector
Thomas Lynch 1 year ago
commit 4efa40a7b4
  1. 2
      lib/permission/permission.js
  2. 2
      lib/permission/permissions.js
  3. 8
      views/includes/globalpermissionsform.pug
  4. 8
      views/pages/editstaff.pug

@ -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));
}
}

@ -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.' },

@ -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')

@ -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')

Loading…
Cancel
Save