class permission implements tool_interface

Migration permission management tool

Properties

protected auth $auth
protected auth_admin $auth_admin
protected service $cache
protected driver_interface $db
protected string $phpbb_root_path
protected string $php_ext

Methods

__construct(driver_interface $db, service $cache, auth $auth, string $phpbb_root_path, string $php_ext)

Constructor

string
get_name()

Retrieve a short name used for commands in migrations.

bool
exists(string $auth_option, bool $global = true)

Permission Exists

null
add(string $auth_option, bool $global = true, int|false $copy_from = false)

Permission Add

null
remove(string $auth_option, bool $global = true)

Permission Remove

int
role_exists(string $role_name)

Check if a permission role exists

null
role_add(string $role_name, string $role_type, string $role_description = '')

Add a new permission role

null
role_update(string $old_role_name, string $new_role_name)

Update the name on a permission role

null
role_remove(string $role_name)

Remove a permission role

null
permission_set(string $name, string|array $auth_option, string $type = 'role', bool $has_permission = true)

Permission Set

null
permission_unset(string $name, string|array $auth_option, string $type = 'role')

Permission Unset

null
reverse()

Reverse an original install action

Details

at line 48
__construct(driver_interface $db, service $cache, auth $auth, string $phpbb_root_path, string $php_ext)

Constructor

Parameters

driver_interface $db
service $cache
auth $auth
string $phpbb_root_path
string $php_ext

at line 66
string get_name()

Retrieve a short name used for commands in migrations.

Return Value

string

short name

at line 81
bool exists(string $auth_option, bool $global = true)

Permission Exists

Check if a permission (auth) setting exists

Parameters

string $auth_option

The name of the permission (auth) option

bool $global

True for checking a global permission setting, False for a local permission setting

Return Value

bool

true if it exists, false if not

at line 120
null add(string $auth_option, bool $global = true, int|false $copy_from = false)

Permission Add

Add a permission (auth) option

Parameters

string $auth_option

The name of the permission (auth) option

bool $global

True for checking a global permission setting, False for a local permission setting

int|false $copy_from

If set, contains the id of the permission from which to copy the new one.

Return Value

null

at line 197
null remove(string $auth_option, bool $global = true)

Permission Remove

Remove a permission (auth) option

Parameters

string $auth_option

The name of the permission (auth) option

bool $global

True for checking a global permission setting, False for a local permission setting

Return Value

null

at line 253
int role_exists(string $role_name)

Check if a permission role exists

Parameters

string $role_name

The role name

Return Value

int

The id of the role if it exists, 0 otherwise

at line 274
null role_add(string $role_name, string $role_type, string $role_description = '')

Add a new permission role

Parameters

string $role_name

The new role name

string $role_type

The type (u, m, a_)

string $role_description

Description of the new role

Return Value

null

at line 309
null role_update(string $old_role_name, string $new_role_name)

Update the name on a permission role

Parameters

string $old_role_name

The old role name

string $new_role_name

The new role name

Return Value

null

Exceptions

exception

at line 328
null role_remove(string $role_name)

Remove a permission role

Parameters

string $role_name

The role name to remove

Return Value

null

at line 420
null permission_set(string $name, string|array $auth_option, string $type = 'role', bool $has_permission = true)

Permission Set

Allows you to set permissions for a certain group/role

Parameters

string $name

The name of the role/group

string|array $auth_option

The auth_option or array of auth_options you would like to set

string $type

The type (role|group)

bool $has_permission

True if you want to give them permission, false if you want to deny them permission

Return Value

null

Exceptions

exception

at line 570
null permission_unset(string $name, string|array $auth_option, string $type = 'role')

Permission Unset

Allows you to unset (remove) permissions for a certain group/role

Parameters

string $name

The name of the role/group

string|array $auth_option

The auth_option or array of auth_options you would like to set

string $type

The type (role|group)

Return Value

null

Exceptions

exception

at line 655
null reverse()

Reverse an original install action

First argument is the original call to the class (e.g. add, remove) After the first argument, send the original arguments to the function in the original call

Return Value

null