Documentation

Permissions
in package
implements ActionInterface uses ActionTrait, BackwardCompatibility

Permissions handles all possible permission stuff.

Table of Contents

Interfaces

ActionInterface
Interface for all action classes.

Constants

BOARD_LEVEL_FREE  = 3
BOARD_LEVEL_LOCKED  = 1
BOARD_LEVEL_PUBLISH  = 2
BOARD_LEVEL_STANDARD  = 0
GROUP_LEVEL_MAINTENANCE  = 3
GROUP_LEVEL_MODERATOR  = 2
GROUP_LEVEL_RESTRICT  = 0
GROUP_LEVEL_STANDARD  = 1
PROFILE_DEFAULT  = 1
PROFILE_NO_POLLS  = 2
PROFILE_PREDEFINED  = [1, 2, 3, 4]
PROFILE_READ_ONLY  = 4
PROFILE_REPLY_ONLY  = 3
PROFILE_UNMODIFIABLE  = [2, 3, 4]

Properties

$hidden  : array<string|int, mixed>
$left_permission_groups  : array<string|int, mixed>
$permission_groups  : array<string|int, mixed>
$postmod_maps  : array<string|int, mixed>
$subaction  : string
$subactions  : array<string|int, mixed>
$allowed_denied  : array<string|int, mixed>
$excluded  : array<string|int, mixed>
$illegal  : array<string|int, mixed>
$never_guests  : array<string|int, mixed>
$obj  : static
$permissions  : array<string|int, mixed>
$processed  : bool

Methods

board()  : void
Handle permissions by board... more or less. :P
buildHidden()  : void
Populates self::$hidden with a list of hidden permissions.
call()  : void
Convenience method to load() and execute() an instance of this class.
canBeLogged()  : bool
Determines whether this action can be logged in the online log.
canShowDebuggingInfo()  : bool
Determines whether debugging info should be shown.
canShowInMaintenanceMode()  : bool
Determines whether this action allows access in maintenance mode.
execute()  : void
Dispatches to the right method based on the given sub-action.
getConfigVars()  : array<string|int, mixed>
Gets the configuration variables for this admin area.
getOutputType()  : OutputTypeInterface
Gets the output type for this action.
getPermissions()  : array<string|int, mixed>
Gets the list of all known permissions.
index()  : void
Sets up the permissions by membergroup index page.
init_inline_permissions()  : void
Initialize a form with inline permissions settings.
isAgreementAction()  : bool
Determines whether this action can be accessed without accepting the registration agreement and privacy policy.
isRestrictedGuestAccessAllowed()  : bool
Determines whether this action allows access if guest access is restricted.
isSimpleAction()  : bool
Determines whether this is a simple action.
load()  : static
Static wrapper for constructor.
loadIllegalPermissions()  : array<string|int, mixed>
Loads a list of permissions that the current user cannot grant.
loadPermissionProfiles()  : void
Load permissions profiles.
modify()  : void
Initializes the necessary stuff to modify a membergroup's permissions.
modify2()  : void
This method actually saves modifications to a membergroup's board permissions.
postmod()  : void
Present a nice way of applying post moderation.
profiles()  : void
Add/Edit/Delete profiles.
quick()  : void
Handles permission modification actions from the upper part of the permission manager index.
save_inline_permissions()  : void
Save the permissions of a form containing inline permissions.
setPermissionLevel()  : void
Set the permission level for a specific profile, group, or group for a profile.
settings()  : void
A screen to set some general settings for permissions.
subActionProvider()  : null|array<string|int, mixed>
Called by Subs-Compat.php BackwardCompatibility wrapper functions to provide subaction execution for existing mods
theme_inline_permissions()  : void
Show a collapsible box to set a specific permission.
updateChildPermissions()  : bool
This function updates the permissions of any groups based off this group.
__construct()  : mixed
Constructor. Protected to force instantiation via self::load().
createProfile()  : void
Creates a new permission profile by copying an existing one.
deleteProfile()  : void
Deletes one or more permission profiles.
getParentGroup()  : int
Gets the parent membergroup of the given membergroup.
integrateLoadIllegalGuestPermissions()  : void
Calls the deprecated integrate_load_illegal_guest_permissions hook.
integrateLoadIllegalPermissions()  : void
Calls the deprecated integrate_load_illegal_permissions hook.
integrateLoadPermissions()  : void
Calls the deprecated integrate_load_permissions hook.
loadAllPermissions()  : void
Load permissions into Utils::$context['permissions'].
loadIllegalBBCHtmlGroups()  : array<string|int, mixed>
Loads a list of membergroups who cannot be granted the bbc_html permission.
loadIllegalGuestPermissions()  : array<string|int, mixed>
Loads the permissions that cannot be given to guests.
quickCopyFrom()  : void
Sets a permission profile based on the permissions of a selected group.
quickSetPermission()  : void
Sets or unsets a certain permission for the selected groups.
quickSetPredefined()  : void
Sets a predefined permission profile.
removeIllegalBBCHtmlPermission()  : void
Removes the bbc_html permission from anyone who shouldn't have it.
renameProfile()  : void
Renames one or more permission profiles.
setAllowedDenied()  : void
Fetches the current allowed or denied values stored in the database for each permission, and populates $this->allowed_denied with those values.
setGroupContext()  : void
Populates Utils::$context['group'].
setGroupsContext()  : void
Populates Utils::$context['groups'].
setOnOff()  : void
Sets 'select' for each permission in Utils::$context['permissions'].
setProfileContext()  : void
Sets Utils::$context['profile'] and Utils::$context['permission_type'].
updateBoardManagers()  : void
Makes sure Config::$modSettings['board_manager_groups'] is up to date.
updateBoardPermissions()  : void
Saves board permissions to the database for the given membergroup.
updateGlobalPermissions()  : void
Saves global permissions to the database for the given membergroup.

Constants

BOARD_LEVEL_LOCKED

public mixed BOARD_LEVEL_LOCKED = 1

BOARD_LEVEL_PUBLISH

public mixed BOARD_LEVEL_PUBLISH = 2

BOARD_LEVEL_STANDARD

public mixed BOARD_LEVEL_STANDARD = 0

GROUP_LEVEL_MAINTENANCE

public mixed GROUP_LEVEL_MAINTENANCE = 3

GROUP_LEVEL_MODERATOR

public mixed GROUP_LEVEL_MODERATOR = 2

GROUP_LEVEL_RESTRICT

public mixed GROUP_LEVEL_RESTRICT = 0

GROUP_LEVEL_STANDARD

public mixed GROUP_LEVEL_STANDARD = 1

PROFILE_PREDEFINED

public mixed PROFILE_PREDEFINED = [1, 2, 3, 4]

PROFILE_READ_ONLY

public mixed PROFILE_READ_ONLY = 4

PROFILE_REPLY_ONLY

public mixed PROFILE_REPLY_ONLY = 3

PROFILE_UNMODIFIABLE

public mixed PROFILE_UNMODIFIABLE = [2, 3, 4]

Properties

$hidden

public static array<string|int, mixed> $hidden

Convenience array listing hidden permissions.

$left_permission_groups

public static array<string|int, mixed> $left_permission_groups = ['general', 'calendar', 'maintenance', 'member_admin', 'topic', 'post']

Permission view_groups that should be shown in the left column of the UI.

$permission_groups

public static array<string|int, mixed> $permission_groups = ['global' => ['general', 'pm', 'calendar', 'maintenance', 'member_admin', 'profile', 'profile_account', 'likes', 'mentions', 'bbc'], 'board' => ['general_board', 'topic', 'post', 'poll', 'attachment']]

Organized list of permission view_groups. This ensures that permissions are presented in a stable order in the UI.

Keys are permission scopes, values are lists of view_groups.

$postmod_maps

public array<string|int, mixed> $postmod_maps = ['new_topic' => ['post_new', 'post_unapproved_topics'], 'replies_own' => ['post_reply_own', 'post_unapproved_replies_own'], 'replies_any' => ['post_reply_any', 'post_unapproved_replies_any'], 'attachment' => ['post_attachment', 'post_unapproved_attachments']]

Maps the permission groups used in the post moderation permissions UI to real permissions.

Format: permission_group => array(can_do_moderated, can_do_all)

$subaction

public string $subaction = 'index'

The requested sub-action. This should be set by the constructor.

$subactions

public static array<string|int, mixed> $subactions = ['index' => ['index', 'manage_permissions'], 'board' => ['board', 'manage_permissions'], 'modify' => ['modify', 'manage_permissions'], 'modify2' => ['modify2', 'manage_permissions'], 'quick' => ['quick', 'manage_permissions'], 'postmod' => ['postmod', 'manage_permissions'], 'profiles' => ['profiles', 'manage_permissions'], 'settings' => ['settings', 'admin_forum']]

Available sub-actions.

Format: 'sub-action' => array('method_to_call', 'permission_needed')

$allowed_denied

protected array<string|int, mixed> $allowed_denied = ['global' => ['allowed' => [], 'denied' => []], 'board' => ['allowed' => [], 'denied' => []]]

Permissions that are allowed or denied for the relevant membergroup. Used by the modify() method.

$excluded

protected static array<string|int, mixed> $excluded = []

Convenience array listing permissions that certain groups may not have.

$illegal

protected static array<string|int, mixed> $illegal = []

Convenience array listing permissions that the current user can't change.

$never_guests

protected static array<string|int, mixed> $never_guests = []

Convenience array listing permissions that guests may never have.

$obj

protected static static $obj

An instance of this class. This is used by the load() method to prevent multiple instantiations.

$permissions

protected static array<string|int, mixed> $permissions = ['access_mod_center' => ['view_group' => 'maintenance', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MODERATOR, 'never_guests' => true], 'admin_forum' => ['view_group' => 'maintenance', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true, 'assigner_prerequisites' => ['admin_forum']], 'announce_topic' => ['view_group' => 'topic', 'scope' => 'board', 'never_guests' => true], 'approve_posts' => ['view_group' => 'general_board', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_MODERATOR, 'board_level' => self::BOARD_LEVEL_FREE, 'never_guests' => true], 'bbc_cowsay' => ['view_group' => 'bbc', 'scope' => 'global', 'hidden' => true, 'vsprintf' => ['permissionname_bbc', ['cowsay']]], 'bbc_html' => ['view_group' => 'bbc', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'vsprintf' => ['permissionname_bbc', ['html']], 'never_guests' => true, 'assignee_prerequisites' => ['admin_forum', 'manage_membergroups', 'manage_permissions'], 'assigner_prerequisites' => ['admin_forum']], 'calendar_edit_own' => ['generic_name' => 'calendar_edit', 'own_any' => 'own', 'view_group' => 'calendar', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MODERATOR, 'never_guests' => true], 'calendar_edit_any' => ['generic_name' => 'calendar_edit', 'own_any' => 'any', 'view_group' => 'calendar', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true], 'calendar_post' => ['view_group' => 'calendar', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MODERATOR], 'calendar_view' => ['view_group' => 'calendar', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_RESTRICT], 'delete_own' => ['generic_name' => 'delete', 'own_any' => 'own', 'view_group' => 'post', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_RESTRICT, 'board_level' => self::BOARD_LEVEL_PUBLISH, 'never_guests' => true], 'delete_any' => ['generic_name' => 'delete', 'own_any' => 'any', 'view_group' => 'post', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_MODERATOR, 'board_level' => self::BOARD_LEVEL_FREE, 'never_guests' => true], 'delete_replies' => ['view_group' => 'topic', 'scope' => 'board', 'board_level' => self::BOARD_LEVEL_PUBLISH, 'never_guests' => true], 'edit_news' => ['view_group' => 'maintenance', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true], 'issue_warning' => ['view_group' => 'member_admin', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MODERATOR, 'never_guests' => true], 'likes_like' => ['view_group' => 'likes', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD, 'never_guests' => true], 'lock_own' => ['generic_name' => 'lock', 'own_any' => 'own', 'view_group' => 'topic', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_STANDARD, 'board_level' => self::BOARD_LEVEL_PUBLISH, 'never_guests' => true], 'lock_any' => ['generic_name' => 'lock', 'own_any' => 'any', 'view_group' => 'topic', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_MODERATOR, 'board_level' => self::BOARD_LEVEL_FREE, 'never_guests' => true], 'make_sticky' => ['view_group' => 'topic', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_MODERATOR, 'board_level' => self::BOARD_LEVEL_FREE, 'never_guests' => true], 'manage_attachments' => ['view_group' => 'maintenance', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true], 'manage_bans' => ['view_group' => 'member_admin', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true], 'manage_boards' => ['view_group' => 'maintenance', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true], 'manage_membergroups' => ['view_group' => 'member_admin', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true, 'assigner_prerequisites' => ['manage_membergroups']], 'manage_permissions' => ['view_group' => 'member_admin', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true, 'assigner_prerequisites' => ['manage_permissions']], 'manage_smileys' => ['view_group' => 'maintenance', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true], 'mention' => ['view_group' => 'mentions', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD], 'merge_any' => ['view_group' => 'topic', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_MODERATOR, 'board_level' => self::BOARD_LEVEL_FREE, 'never_guests' => true], 'moderate_board' => ['view_group' => 'general_board', 'scope' => 'board', 'never_guests' => true], 'moderate_forum' => ['view_group' => 'member_admin', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true], 'modify_own' => ['generic_name' => 'modify', 'own_any' => 'own', 'view_group' => 'post', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_RESTRICT, 'board_level' => self::BOARD_LEVEL_PUBLISH, 'never_guests' => true], 'modify_any' => ['generic_name' => 'modify', 'own_any' => 'any', 'view_group' => 'post', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_MODERATOR, 'board_level' => self::BOARD_LEVEL_FREE, 'never_guests' => true], 'modify_replies' => ['view_group' => 'topic', 'scope' => 'board', 'board_level' => self::BOARD_LEVEL_PUBLISH, 'never_guests' => true], 'move_own' => ['generic_name' => 'move', 'own_any' => 'own', 'view_group' => 'topic', 'scope' => 'board', 'never_guests' => true], 'move_any' => ['generic_name' => 'move', 'own_any' => 'any', 'view_group' => 'topic', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_MODERATOR, 'never_guests' => true], 'pm_draft' => ['view_group' => 'pm', 'scope' => 'global', 'never_guests' => true], 'pm_read' => ['view_group' => 'pm', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD, 'never_guests' => true], 'pm_send' => ['view_group' => 'pm', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD, 'never_guests' => true], 'poll_add_own' => ['generic_name' => 'poll_add', 'own_any' => 'own', 'view_group' => 'poll', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_STANDARD, 'board_level' => self::BOARD_LEVEL_PUBLISH, 'never_guests' => true], 'poll_add_any' => ['generic_name' => 'poll_add', 'own_any' => 'any', 'view_group' => 'poll', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_MODERATOR, 'board_level' => self::BOARD_LEVEL_FREE, 'never_guests' => true], 'poll_edit_own' => ['generic_name' => 'poll_edit', 'own_any' => 'own', 'view_group' => 'poll', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_STANDARD, 'board_level' => self::BOARD_LEVEL_PUBLISH, 'never_guests' => true], 'poll_edit_any' => ['generic_name' => 'poll_edit', 'own_any' => 'any', 'view_group' => 'poll', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_MODERATOR, 'board_level' => self::BOARD_LEVEL_FREE, 'never_guests' => true], 'poll_lock_own' => ['generic_name' => 'poll_lock', 'own_any' => 'own', 'view_group' => 'poll', 'scope' => 'board', 'never_guests' => true], 'poll_lock_any' => ['generic_name' => 'poll_lock', 'own_any' => 'any', 'view_group' => 'poll', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_MODERATOR, 'board_level' => self::BOARD_LEVEL_FREE, 'never_guests' => true], 'poll_post' => ['view_group' => 'poll', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_STANDARD, 'board_level' => self::BOARD_LEVEL_PUBLISH], 'poll_remove_own' => ['generic_name' => 'poll_remove', 'own_any' => 'own', 'view_group' => 'poll', 'scope' => 'board', 'board_level' => self::BOARD_LEVEL_PUBLISH, 'never_guests' => true], 'poll_remove_any' => ['generic_name' => 'poll_remove', 'own_any' => 'any', 'view_group' => 'poll', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_MODERATOR, 'board_level' => self::BOARD_LEVEL_FREE, 'never_guests' => true], 'poll_view' => ['view_group' => 'poll', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_RESTRICT, 'board_level' => self::BOARD_LEVEL_LOCKED], 'poll_vote' => ['view_group' => 'poll', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_STANDARD, 'board_level' => self::BOARD_LEVEL_PUBLISH], 'post_attachment' => ['view_group' => 'attachment', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_STANDARD, 'board_level' => self::BOARD_LEVEL_PUBLISH], 'post_draft' => ['view_group' => 'topic', 'scope' => 'board', 'never_guests' => true], 'post_new' => ['view_group' => 'topic', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_RESTRICT, 'board_level' => self::BOARD_LEVEL_PUBLISH], 'post_reply_own' => ['generic_name' => 'post_reply', 'own_any' => 'own', 'view_group' => 'topic', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_RESTRICT, 'board_level' => self::BOARD_LEVEL_PUBLISH], 'post_reply_any' => ['generic_name' => 'post_reply', 'own_any' => 'any', 'view_group' => 'topic', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_RESTRICT, 'board_level' => self::BOARD_LEVEL_PUBLISH], 'post_unapproved_attachments' => ['view_group' => 'attachment', 'scope' => 'board'], 'post_unapproved_replies_own' => ['generic_name' => 'post_unapproved_replies', 'own_any' => 'own', 'view_group' => 'topic', 'scope' => 'board'], 'post_unapproved_replies_any' => ['generic_name' => 'post_unapproved_replies', 'own_any' => 'any', 'view_group' => 'topic', 'scope' => 'board'], 'post_unapproved_topics' => ['view_group' => 'topic', 'scope' => 'board'], 'profile_blurb_own' => ['generic_name' => 'profile_blurb', 'own_any' => 'own', 'view_group' => 'profile', 'scope' => 'global', 'never_guests' => true], 'profile_blurb_any' => ['generic_name' => 'profile_blurb', 'own_any' => 'any', 'view_group' => 'profile', 'scope' => 'global', 'never_guests' => true], 'profile_displayed_name_own' => ['generic_name' => 'profile_displayed_name', 'own_any' => 'own', 'view_group' => 'profile_account', 'scope' => 'global', 'never_guests' => true], 'profile_displayed_name_any' => ['generic_name' => 'profile_displayed_name', 'own_any' => 'any', 'view_group' => 'profile_account', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true], 'profile_extra_own' => ['generic_name' => 'profile_extra', 'own_any' => 'own', 'view_group' => 'profile', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD, 'never_guests' => true], 'profile_extra_any' => ['generic_name' => 'profile_extra', 'own_any' => 'any', 'view_group' => 'profile', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true], 'profile_forum_own' => ['generic_name' => 'profile_forum', 'own_any' => 'own', 'view_group' => 'profile', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD, 'never_guests' => true], 'profile_forum_any' => ['generic_name' => 'profile_forum', 'own_any' => 'any', 'view_group' => 'profile', 'scope' => 'global', 'never_guests' => true], 'profile_gravatar' => ['view_group' => 'profile', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD, 'never_guests' => true], 'profile_identity_own' => ['generic_name' => 'profile_identity', 'own_any' => 'own', 'view_group' => 'profile_account', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_RESTRICT, 'never_guests' => true], 'profile_identity_any' => ['generic_name' => 'profile_identity', 'own_any' => 'any', 'view_group' => 'profile_account', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true], 'profile_password_own' => ['generic_name' => 'profile_password', 'own_any' => 'own', 'view_group' => 'profile_account', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD, 'never_guests' => true], 'profile_password_any' => ['generic_name' => 'profile_password', 'own_any' => 'any', 'view_group' => 'profile_account', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true], 'profile_remote_avatar' => ['view_group' => 'profile', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD, 'never_guests' => true], 'profile_remove_own' => ['generic_name' => 'profile_remove', 'own_any' => 'own', 'view_group' => 'profile_account', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD, 'never_guests' => true], 'profile_remove_any' => ['generic_name' => 'profile_remove', 'own_any' => 'any', 'view_group' => 'profile_account', 'scope' => 'global', 'never_guests' => true], 'profile_server_avatar' => ['view_group' => 'profile', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD, 'never_guests' => true], 'profile_signature_own' => ['generic_name' => 'profile_signature', 'own_any' => 'own', 'view_group' => 'profile', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD, 'never_guests' => true], 'profile_signature_any' => ['generic_name' => 'profile_signature', 'own_any' => 'any', 'view_group' => 'profile', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true], 'profile_title_own' => ['generic_name' => 'profile_title', 'own_any' => 'own', 'view_group' => 'profile', 'scope' => 'global', 'never_guests' => true], 'profile_title_any' => ['generic_name' => 'profile_title', 'own_any' => 'any', 'view_group' => 'profile', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true], 'profile_upload_avatar' => ['view_group' => 'profile', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD, 'never_guests' => true], 'profile_view' => ['view_group' => 'profile', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD], 'profile_website_own' => ['generic_name' => 'profile_website', 'own_any' => 'own', 'view_group' => 'profile', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD, 'never_guests' => true], 'profile_website_any' => ['generic_name' => 'profile_website', 'own_any' => 'any', 'view_group' => 'profile', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_MAINTENANCE, 'never_guests' => true], 'remove_own' => ['generic_name' => 'remove', 'own_any' => 'own', 'view_group' => 'topic', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_STANDARD, 'board_level' => self::BOARD_LEVEL_PUBLISH, 'never_guests' => true], 'remove_any' => ['generic_name' => 'remove', 'own_any' => 'any', 'view_group' => 'topic', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_MODERATOR, 'board_level' => self::BOARD_LEVEL_FREE, 'never_guests' => true], 'report_any' => ['view_group' => 'post', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_RESTRICT, 'board_level' => self::BOARD_LEVEL_LOCKED, 'never_guests' => true], 'report_user' => ['view_group' => 'profile', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD, 'never_guests' => true], 'search_posts' => ['view_group' => 'general', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_RESTRICT], 'send_mail' => ['view_group' => 'member_admin', 'scope' => 'global', 'never_guests' => true], 'split_any' => ['view_group' => 'topic', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_MODERATOR, 'board_level' => self::BOARD_LEVEL_FREE, 'never_guests' => true], 'view_attachments' => ['view_group' => 'attachment', 'scope' => 'board', 'group_level' => self::GROUP_LEVEL_STANDARD, 'board_level' => self::BOARD_LEVEL_LOCKED], 'view_mlist' => ['view_group' => 'general', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_STANDARD], 'view_stats' => ['view_group' => 'general', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_RESTRICT], 'view_warning_own' => ['generic_name' => 'view_warning', 'own_any' => 'own', 'view_group' => 'profile_account', 'scope' => 'global'], 'view_warning_any' => ['generic_name' => 'view_warning', 'own_any' => 'any', 'view_group' => 'profile_account', 'scope' => 'global'], 'who_view' => ['view_group' => 'general', 'scope' => 'global', 'group_level' => self::GROUP_LEVEL_RESTRICT]]

List of all known permissions. Protected to force access via getPermissions().

Mods can add to this list using the integrate_permission_list hook.

For each permission, the available keys and their meaning are as follows:

  • generic_name: This is used to group own/any variants together. For permissions that don't have own/any variants, this is can be left unset. The default is the same as the permission name.

  • own_any: Indicates whether this is the "own" or the "any" variant of the generic permission. Not applicable for permissions that don't have own/any variants.

  • view_group: Name of the group to show the permission within on the profile profile editing page.

  • scope: Either 'board' for permissions that apply at the board level, or 'global' for permissions that apply everywhere.

  • group_level: Used by the predefined permission profiles to indicate the minimum group level that this permission should be granted at.

  • board_level: Used by the predefined permission profiles to indicate the minimum board level that this permission should be granted at.

  • hidden: If true, permission should not be shown in the UI.

  • label: Indicates the Lang::$txt string to use as the generic label for this permission. Defaults to 'permissionname_' . generic_name.

  • vsprintf: Arguments passed to Lang::formatText() at runtime to generate the finalized form of the label string.

  • never_guests: If true, this permission can never be granted to guests.

  • assignee_prerequisites: Permissions that someone must already have at least one of before they can be granted this permission.

  • assigner_prerequisites: Permissions that someone must have at least one of before they can grant this permission to anyone.

$processed

protected static bool $processed = false

Whether self::$permissions has already be processed by getPermissions().

Methods

board()

Handle permissions by board... more or less. :P

public board() : void

buildHidden()

Populates self::$hidden with a list of hidden permissions.

public static buildHidden() : void

call()

Convenience method to load() and execute() an instance of this class.

public static call() : void

canBeLogged()

Determines whether this action can be logged in the online log.

public canBeLogged() : bool
Return values
bool

canShowDebuggingInfo()

Determines whether debugging info should be shown.

public canShowDebuggingInfo() : bool
Return values
bool

canShowInMaintenanceMode()

Determines whether this action allows access in maintenance mode.

public canShowInMaintenanceMode() : bool
Return values
bool

True if access is allowed, false otherwise.

execute()

Dispatches to the right method based on the given sub-action.

public execute() : void

Checks the permissions, based on the sub-action. Called by ?action=admin;area=permissions.

Uses ManagePermissions language file.

getConfigVars()

Gets the configuration variables for this admin area.

public static getConfigVars() : array<string|int, mixed>
Return values
array<string|int, mixed>

$config_vars for the permissions area.

getPermissions()

Gets the list of all known permissions.

public static getPermissions() : array<string|int, mixed>

This method contains the integrate_permissions_list hook, which is the recommended way to add new permissions to SMF.

Return values
array<string|int, mixed>

Finalized version of self::$permissions

index()

Sets up the permissions by membergroup index page.

public index() : void

Called by ?action=admin;area=permissions;sa=index Creates an array of all the groups with the number of members and permissions.

Uses ManagePermissions language file. Uses ManagePermissions template file.

Tags
uses
template_permission_index()

init_inline_permissions()

Initialize a form with inline permissions settings.

public static init_inline_permissions(array<string|int, mixed> $permissions[, array<string|int, mixed> $excluded_groups = [] ]) : void

It loads a context variable for each permission. This method is used by several settings screens to set specific permissions.

To exclude groups from the form for a given permission, add the group IDs as an array to Utils::$context['excluded_permissions'][$permission]. For backwards compatibility, it is also possible to pass group IDs in via the $excluded_groups parameter, which will exclude the groups from the forms for all of the permissions passed in via $permissions.

Parameters
$permissions : array<string|int, mixed>

The permissions to display inline

$excluded_groups : array<string|int, mixed> = []

The IDs of one or more groups to exclude

Uses ManagePermissions language Uses ManagePermissions template

isAgreementAction()

Determines whether this action can be accessed without accepting the registration agreement and privacy policy.

public isAgreementAction() : bool
Return values
bool

isRestrictedGuestAccessAllowed()

Determines whether this action allows access if guest access is restricted.

public isRestrictedGuestAccessAllowed() : bool
Return values
bool

True if access is allowed, false otherwise.

isSimpleAction()

Determines whether this is a simple action.

public isSimpleAction() : bool
Return values
bool

load()

Static wrapper for constructor.

public static load() : static
Return values
static

An instance of this class.

loadIllegalPermissions()

Loads a list of permissions that the current user cannot grant.

public static loadIllegalPermissions() : array<string|int, mixed>
Return values
array<string|int, mixed>

Permissions that the current user cannot grant.

loadPermissionProfiles()

Load permissions profiles.

public static loadPermissionProfiles() : void

modify()

Initializes the necessary stuff to modify a membergroup's permissions.

public modify() : void

modify2()

This method actually saves modifications to a membergroup's board permissions.

public modify2() : void

postmod()

Present a nice way of applying post moderation.

public postmod() : void

profiles()

Add/Edit/Delete profiles.

public profiles() : void

quick()

Handles permission modification actions from the upper part of the permission manager index.

public quick() : void

save_inline_permissions()

Save the permissions of a form containing inline permissions.

public static save_inline_permissions(array<string|int, mixed> $permissions) : void
Parameters
$permissions : array<string|int, mixed>

The permissions to save

setPermissionLevel()

Set the permission level for a specific profile, group, or group for a profile.

public static setPermissionLevel(string $level, int $group[, string|int $profile = 'null' ]) : void
Parameters
$level : string

The level ('restrict', 'standard', etc.)

$group : int

The group to set the permission for

$profile : string|int = 'null'

The ID of the permissions profile or 'null' if we're setting it for a group

settings()

A screen to set some general settings for permissions.

public settings() : void

subActionProvider()

Called by Subs-Compat.php BackwardCompatibility wrapper functions to provide subaction execution for existing mods

public static subActionProvider([null|string $sa = null ][, bool $return_config = false ][, string|null $activity = null ]) : null|array<string|int, mixed>
Parameters
$sa : null|string = null
$return_config : bool = false
$activity : string|null = null
Return values
null|array<string|int, mixed>

theme_inline_permissions()

Show a collapsible box to set a specific permission.

public static theme_inline_permissions(string $permission) : void

The method is called by templates to show a list of permissions settings. Calls the template function template_inline_permissions().

Parameters
$permission : string

The permission to display inline

updateChildPermissions()

This function updates the permissions of any groups based off this group.

public static updateChildPermissions([int|array<string|int, mixed> $parents = null ][, int $profile = null ]) : bool
Parameters
$parents : int|array<string|int, mixed> = null

The parent groups.

$profile : int = null

The ID of a permissions profile to update

Return values
bool

Returns true if successful or false if there are no child groups to update.

__construct()

Constructor. Protected to force instantiation via self::load().

protected __construct() : mixed

createProfile()

Creates a new permission profile by copying an existing one.

protected createProfile() : void

The ID of the profile to copy must be given in $_POST['copy_from']. The name for the new profile must be given in $_POST['profile_name'].

deleteProfile()

Deletes one or more permission profiles.

protected deleteProfile() : void

Acts on profiles listed in $_POST['delete_profile'], which must be an array of profile ID numbers.

Attempts to delete predefined profiles will be silently rejected.

Attempts to delete profiles that are in use will abort with an error.

getParentGroup()

Gets the parent membergroup of the given membergroup.

protected getParentGroup(int $group) : int

This is used to determine permission inheritance.

Parameters
$group : int

ID of a membergroup.

Return values
int

The ID of the parent membergroup, or -2 if it has no parent.

integrateLoadIllegalGuestPermissions()

Calls the deprecated integrate_load_illegal_guest_permissions hook.

protected static integrateLoadIllegalGuestPermissions() : void

MOD AUTHORS: Please update your code to use integrate_permissions_list.

integrateLoadIllegalPermissions()

Calls the deprecated integrate_load_illegal_permissions hook.

protected static integrateLoadIllegalPermissions() : void

MOD AUTHORS: Please update your code to use integrate_permissions_list.

integrateLoadPermissions()

Calls the deprecated integrate_load_permissions hook.

protected static integrateLoadPermissions() : void

MOD AUTHORS: Please update your code to use integrate_permissions_list.

loadAllPermissions()

Load permissions into Utils::$context['permissions'].

protected static loadAllPermissions() : void

loadIllegalBBCHtmlGroups()

Loads a list of membergroups who cannot be granted the bbc_html permission.

protected static loadIllegalBBCHtmlGroups() : array<string|int, mixed>

Stores the groups in self::$excluded['bbc_html'].

Return values
array<string|int, mixed>

A copy of self::$excluded['bbc_html'].

loadIllegalGuestPermissions()

Loads the permissions that cannot be given to guests.

protected static loadIllegalGuestPermissions() : array<string|int, mixed>

Stores the permissions in self::$never_guests. Also populates self::$excluded with the info.

Return values
array<string|int, mixed>

A copy of self::$never_guests.

quickCopyFrom()

Sets a permission profile based on the permissions of a selected group.

protected quickCopyFrom() : void

Helper method called from quick().

quickSetPermission()

Sets or unsets a certain permission for the selected groups.

protected quickSetPermission() : void

Helper method called from quick().

quickSetPredefined()

Sets a predefined permission profile.

protected quickSetPredefined() : void

Helper method called from quick().

removeIllegalBBCHtmlPermission()

Removes the bbc_html permission from anyone who shouldn't have it.

protected static removeIllegalBBCHtmlPermission([bool $reload = false ]) : void
Parameters
$reload : bool = false

Before acting, refresh the list of membergroups who cannot be granted the bbc_html permission

renameProfile()

Renames one or more permission profiles.

protected renameProfile() : void

Acts on the profiles listed in $_POST['rename_profile'], where keys are ID numbers of existing profiles, and values are the new names.

If $_POST['rename_profile'] is not set, this method will instead instruct the UI to show input fields to allow the admin to rename the profiles.

setAllowedDenied()

Fetches the current allowed or denied values stored in the database for each permission, and populates $this->allowed_denied with those values.

protected setAllowedDenied(int $group[, string $scope = 'global' ][, int $profile = 1 ]) : void

Helper method called from modify().

Parameters
$group : int

ID number of a membergroup.

$scope : string = 'global'

Either 'global' or 'board'. If this is 'global', the $profile param will always be treated as 1.

$profile : int = 1

Permission profile to use. Only applicable when the $scope param is set to 'board'.

setGroupContext()

Populates Utils::$context['group'].

protected setGroupContext() : void

Helper method called from modify().

setGroupsContext()

Populates Utils::$context['groups'].

protected setGroupsContext() : void

Helper method called from index().

setOnOff()

Sets 'select' for each permission in Utils::$context['permissions'].

protected setOnOff() : void

Also populates Utils::$context['hidden_perms'].

Helper method called from modify().

setProfileContext()

Sets Utils::$context['profile'] and Utils::$context['permission_type'].

protected setProfileContext() : void

Helper method called from modify().

updateBoardManagers()

Makes sure Config::$modSettings['board_manager_groups'] is up to date.

protected static updateBoardManagers() : void

updateBoardPermissions()

Saves board permissions to the database for the given membergroup.

protected updateBoardPermissions(int $group, array<string|int, mixed> $give_perms, array<string|int, mixed> $illegal_permissions, int $profileid) : void
Parameters
$group : int

ID of a membergroup.

$give_perms : array<string|int, mixed>

The permissions this group has been granted.

$illegal_permissions : array<string|int, mixed>

Permissions that cannot be changed for this group.

$profileid : int

ID of a permission profile.

updateGlobalPermissions()

Saves global permissions to the database for the given membergroup.

protected updateGlobalPermissions(int $group, array<string|int, mixed> $give_perms, array<string|int, mixed> $illegal_permissions) : void
Parameters
$group : int

ID of a membergroup.

$give_perms : array<string|int, mixed>

The permissions this group has been granted.

$illegal_permissions : array<string|int, mixed>

Permissions that cannot be changed for this group.


        
On this page

Search results