\rex_complex_perm

Abstract class for complex permissions.

All permission check methods ("hasPerm()" etc.) in child classes should return "true" for admins

Summary

Methods
Properties
Constants
hasAll()
getFieldParams()
register()
getAll()
get()
removeItem()
replaceItem()
No public properties found
ALL
__construct()
$user
$perms
N/A
No private methods found
No private properties found
N/A

Constants

ALL

ALL = 'all'

Properties

$user

$user : \rex_user

User instance.

Type

rex_user

$perms

$perms : array

Array of permissions.

Type

array

Methods

hasAll()

hasAll() : bool

Returns if the user has the permission for all items.

Returns

bool —

getFieldParams()

getFieldParams() : array

Returns the field params for the role form.

Returns

array —

register()

register(string  $key, string  $class) : mixed

Registers a new complex perm class.

Parameters

string $key

Key for the complex perm

string $class

Class name

Throws

\InvalidArgumentException

Returns

mixed —

getAll()

getAll() : array

Returns all complex perm classes.

Returns

array —

Class names

get()

get(\rex_user  $user, string  $key, mixed  $perms = []) : self|null

Returns the complex perm.

Parameters

\rex_user $user

User instance

string $key

Complex perm key

mixed $perms

Permissions

Returns

self|null —

removeItem()

removeItem(string  $key, string|int  $item) : mixed

Should be called if an item is removed.

Parameters

string $key

Key

string|int $item

Item

Returns

mixed —

replaceItem()

replaceItem(string  $key, string|int  $item, string|int  $new) : mixed

Should be called if an item is replaced.

Parameters

string $key

Key

string|int $item

Old item

string|int $new

New item

Returns

mixed —

__construct()

__construct(\rex_user  $user, mixed  $perms) : mixed

Constructor.

Parameters

\rex_user $user

User instance

mixed $perms

Permissions

Returns

mixed —