Umil.permission unset
From phpBB Development Wiki
umil::permission_unset –– Set permissions to "No" for a certain group/role using the Umil Library.
To set permissions to "Yes" or "Never" see Umil.permission_set.
Please note that forum (local) permissions can not be unset for groups using this method.
Contents |
Description
string umil::permission_unset ( mixed $name [, mixed $auth_option [, string $type ]] )
Parameters
| Parameter | Required/Default | Usage |
|---|---|---|
| name | Required | The name of the role/group |
| auth_option | default array() | The (string) auth_option or array of auth_options you would like to unset |
| type | default 'role' | The type of permissions you would like to set - 'role' or 'group' |
Return Values
Returns result or umil_end data
Examples
Example #1
Remove the 'a_test_mod' permission from the 'ROLE_ADMIN_FULL' role
$umil->permission_unset('ROLE_ADMIN_FULL', 'a_test_mod');
Example #2
Remove the 'f_test_mod' permission from the 'ROLE_FORUM_FULL' role
$umil->permission_unset('ROLE_FORUM_FULL', 'f_test_mod');
Example #3
Remove the 'u_test_mod' permission from the 'REGISTERED' group The option to unset group permissions was initially designed so it would be possible to unset permissions from guests (since they do not have a default role). If you would like to unset permissions from a group and it has a default role set to it with phpBB3 it is recommended that you unset the permission from the role and not the group.
$umil->permission_unset('REGISTERED', 'u_test_mod', 'group');
Example #4
Unset multiple permissions from the same role
$umil->permission_unset('ROLE_USER_FULL', array('u_test_mod', 'u_test_mod2', 'u_test_mod3'));
Example #4
Unset multiple permissions from multiple groups and/or roles in one function call
$umil->permission_unset(array(
array('ROLE_ADMIN_FULL', 'a_test_mod', 'role'),
array('ROLE_FORUM_FULL', 'f_test_mod'),
array('REGISTERED', 'u_test_mod', 'group'),
array('ROLE_USER_FULL', array('u_test_mod', 'u_test_mod2', 'u_test_mod3')),
));
See Also

