phpBB API Documentation
Class

phpbb\db\migration\tool\permission

class permission implements tool_interface

Migration permission management tool

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

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 45
public __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 57
public string get_name()

Retrieve a short name used for commands in migrations.

Return Value

string short name

at line 72
public 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 111
public 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 194
public 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 252
public 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 291
public 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 316
public null role_remove(string $role_name)

Remove a permission role

Parameters

string $role_name The role name to remove

Return Value

null

at line 354
public 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 authoption or array of authoptions 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 514
public 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 authoption or array of authoptions you would like to set
string $type The type (role|group)

Return Value

null

Exceptions

exception

at line 601
public 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