fl_permissions_editor panelclient
Panel defined in plugin/views/cl_permissions_editor.lua
Part of Admin Mod
The permission editor: a switch between the player's own permissions and those of the
character they have loaded, and every registered permission, grouped by category, with an
fl_permission row each and buttons that set a whole category at once.
Summary
Methods
Bolt.permissions_editor, so that it hears of the changes to the edited player's permissions.Methods
Returns the ID of the character the edited player has loaded.
Returns
- Number character ID, nil if no player is edited or the player has no character loaded
Collects the value of every row that is not set to PERM_NO.
Returns
- Map PERM_ values keyed by each row's permission data table
Returns the player being edited.
Returns
- Player the player, or nil if none has been set
Creates the switch between the layers and the list of permission rows, and makes the
editor known to the plugin as Bolt.permissions_editor, so that it hears of the changes to
the edited player's permissions.
Loads the current values of the edited layer into the rows: the player's own permissions, or those of their character.
PANEL:on_net_var_changed(entity, key)
client plugins/admin/plugin/views/cl_permissions_editor.lua:441Brings the editor up to date when a networked variable of the edited player has changed. When the player loads, switches or drops a character, the character's permissions are loaded again while they are edited, or the editor goes back to the player's own permissions when the player has no character any more. When the values of the edited layer change, they are loaded into the rows, and every change to the player's role or permissions refreshes the deciding layer of the rows.
Parameters
- entity Entity the entity whose variable has changed
- key String name of the variable
Lets the active theme draw the editor through its PaintPermissionEditor hook.
Parameters
- w Number panel width
- h Number panel height
Recreates the list: a collapsible category per permission category with a row for each permission, plus bulk allow / not set / never buttons where a category has several. The list is docked into a scroll panel, so the rows keep clear of the scroll bar.
Switches the editor between the player's own permissions and those of their character, and loads the values of that layer into the rows.
Parameters
- layer String 'user' or 'character'
PANEL:set_permissions(perm_list, temp_perm_list)
client plugins/admin/plugin/views/cl_permissions_editor.lua:540Selects the given values in the matching rows and marks unexpired temporary permissions. Rows that the lists leave out are set to not set, without a temporary mark.
Parameters
- perm_list Map PERM_ values keyed by permission ID
- temp_perm_list Map optional, defaults to
niltables with value and expires (unix timestamp) fields, keyed by permission ID
Sets the player being edited, rebuilds the rows and loads the values of the edited layer into them: the player's own permissions, or those of their character. The editor goes back to the player's own permissions if the player has no character loaded.
Parameters
- target Player
Refreshes the deciding layer of the rows once a temporary permission of the edited player has expired.
Refreshes the deciding layer of every row, and notes when the next temporary permission of the edited player expires.
Brings the switch between the layers up to date: marks the edited layer, and names the loaded character on its button, which is disabled while the player has none.