AdminPerms
in package
Provides user permisison functions for the admin
Table of Contents
Properties
- $access_flags : mixed
- $subsites_permitted : mixed
Methods
- canAccess() : mixed
- Returns true or false depending on if an access flag is available for this user or not
- canAccessSubsite() : mixed
- Returns true or false depending on if a subsite is available for this user or not
- canEditOperator() : mixed
- Can the currently-logged in operator edit the operator in question?
- checkPermissionsTree() : bool
- Checks whether the currently logged in operator can access the specified item.
- controllerAccess() : mixed
- Returns true or false depending on if an access flag is available for this user or not
- controllerAccessMulti() : mixed
- For a given list of controllers, return a list of controllers which the current user can actually access.
- filterAdminTiles() : array<string|int, mixed>
- Remove controllers and tiles for which the user doesn't have access
- getAccessableGroups() : array<int, int|string>|false
- getFirstAccessable() : mixed
- Get the name of the first controller the user has access to.
- getManageOperatorCategories() : array<string|int, mixed>
- Return the list of operator categories which the currently-logged in operator can manage
- getOperatorsWithAccess() : array<string|int, mixed>
- Get a list of all operators with a specific access flag
- loadAccessFlags() : mixed
- Gets all 'access' flags for this user.
- loadSubsitesPermitted() : array<string|int, mixed>
- Gets all permitted subsite IDs for this user.
Properties
$access_flags
public
static mixed
$access_flags
$subsites_permitted
public
static mixed
$subsites_permitted
Methods
canAccess()
Returns true or false depending on if an access flag is available for this user or not
public
static canAccess(mixed $access_flag) : mixed
Parameters
- $access_flag : mixed
canAccessSubsite()
Returns true or false depending on if a subsite is available for this user or not
public
static canAccessSubsite(mixed $subsite_id) : mixed
Parameters
- $subsite_id : mixed
canEditOperator()
Can the currently-logged in operator edit the operator in question?
public
static canEditOperator(mixed $operator_id) : mixed
Parameters
- $operator_id : mixed
checkPermissionsTree()
Checks whether the currently logged in operator can access the specified item.
public
static checkPermissionsTree(string $table, int $id) : bool
This method should be used for tree-based tables, like the 'pages' table, which may inherit their permissions from the parent record.
Parameters
- $table : string
-
The table name of the item to check
- $id : int
-
The id of the record to check
Return values
bool —True if the operator has access, false otherwise
controllerAccess()
Returns true or false depending on if an access flag is available for this user or not
public
static controllerAccess(string $controller, string $access_flag) : mixed
Parameters
- $controller : string
-
The name of the controller to check an access flag for
- $access_flag : string
-
The flag to check (e.g. 'main', 'add', 'edit', etc)
controllerAccessMulti()
For a given list of controllers, return a list of controllers which the current user can actually access.
public
static controllerAccessMulti(array<string|int, mixed> $controllers) : mixed
This controls which tabs show in the navigation. It checks for the 'contents' access flag.
Parameters
- $controllers : array<string|int, mixed>
filterAdminTiles()
Remove controllers and tiles for which the user doesn't have access
public
static filterAdminTiles(array<string|int, mixed> $tiles) : array<string|int, mixed>
Parameters
- $tiles : array<string|int, mixed>
-
Tile definitions, loaded from Register::getAdminTiles
Return values
array<string|int, mixed> —Tile definitions sans unpermitted controllers
getAccessableGroups()
public
static getAccessableGroups(string $table, int $id) : array<int, int|string>|false
Parameters
- $table : string
- $id : int
Return values
array<int, int|string>|falsegetFirstAccessable()
Get the name of the first controller the user has access to.
public
static getFirstAccessable() : mixed
For most users, this will be 'pages', but it might be something else.
getManageOperatorCategories()
Return the list of operator categories which the currently-logged in operator can manage
public
static getManageOperatorCategories() : array<string|int, mixed>
Return values
array<string|int, mixed> —Categories as id => name
getOperatorsWithAccess()
Get a list of all operators with a specific access flag
public
static getOperatorsWithAccess(string $access_flag) : array<string|int, mixed>
Parameters
- $access_flag : string
-
One of the fields in the operators_cat_list table, e.g. 'access_homepage'
Tags
Return values
array<string|int, mixed> —Matching rows from the operators table
loadAccessFlags()
Gets all 'access' flags for this user.
public
static loadAccessFlags() : mixed
Access flags are specified per operator-group. This function will return the values for all of the defined access flags, returning the greatest-permission flag available for the user. Will get data for the currently logged in user
loadSubsitesPermitted()
Gets all permitted subsite IDs for this user.
public
static loadSubsitesPermitted() : array<string|int, mixed>
Subsite permissions are specified per operator-group. This function will return an array of subsite IDs. Will get data for the currently logged in user
Return values
array<string|int, mixed> —An array of subsite IDs the operator is permitted to work with