From 7e3c424da394edc8165aa10176d74d576a493f71 Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Tue, 20 Dec 2022 13:55:01 +1100 Subject: [PATCH] Small note about global board management permissions, allow subtitles along with titles in permission metadata --- lib/permission/permission.js | 8 +++++--- lib/permission/permissiontext.js | 2 +- views/pages/editrole.pug | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/permission/permission.js b/lib/permission/permission.js index 8e1c1a52..9873b2f1 100644 --- a/lib/permission/permission.js +++ b/lib/permission/permission.js @@ -19,12 +19,14 @@ class Permission extends BigBitfield { toJSON() { return this.constructor.permissionEntries .reduce((acc, entry) => { + const { label, desc, title, subtitle } = PermissionText[entry[0]]; acc[entry[0]] = { bit: entry[1], state: this.get(entry[1]), - label: PermissionText[entry[0]].label, - desc: PermissionText[entry[0]].desc, - title: PermissionText[entry[0]].title, + label, + desc, + title, + subtitle, }; return acc; }, {}); diff --git a/lib/permission/permissiontext.js b/lib/permission/permissiontext.js index 640a657c..244fe6e1 100644 --- a/lib/permission/permissiontext.js +++ b/lib/permission/permissiontext.js @@ -19,7 +19,7 @@ module.exports = { MANAGE_GLOBAL_SETTINGS: { label: 'Global Settings', desc: 'Access global settings. Ability to change any settings.' }, MANAGE_GLOBAL_ACCOUNTS: { label: 'Accounts', desc: 'Access the accounts list. Ability to search/sort. Ability to edit permissions of any user. Can only be given by somebody else with "Root" permission.' }, //view, delete, change account permissions MANAGE_GLOBAL_ROLES: { label: 'Roles', desc: 'Access roles list. Ability to edit roles. Can only be given by somebody else with "Root" permission.' }, //view and edit roles - MANAGE_BOARD_OWNER: { title: 'Board Management', 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!' }, + 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!' }, 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.' }, MANAGE_BOARD_BANS: { label: 'Bans', desc: 'Access board bans. Ability to unban, edit, or deny appeals.' }, MANAGE_BOARD_LOGS: { label: 'Logs', desc: 'Access board logs. Ability to search/filter.' }, diff --git a/views/pages/editrole.pug b/views/pages/editrole.pug index 43d76b9f..8833127d 100644 --- a/views/pages/editrole.pug +++ b/views/pages/editrole.pug @@ -19,6 +19,8 @@ block content if jsonPermissions[perm].title && index > 0 hr(size=1) h4.mv-5 #{jsonPermissions[perm].title} + if jsonPermissions[perm].subtitle + p #{jsonPermissions[perm].subtitle} .row label.postform-style.ph-5 input(type='checkbox' name=perm value=jsonPermissions[perm].bit checked=jsonPermissions[perm].state)