public function AccessPermissions::permissions in Role Access Control 8
Same name and namespace in other branches
- 8.2 src/AccessPermissions.php \Drupal\rac\AccessPermissions::permissions()
Returns an array of role access permissions.
Return value
array A list of generated permissions.
1 string reference to 'AccessPermissions::permissions'
File
- src/
AccessPermissions.php, line 20
Class
- AccessPermissions
- Permissions generation Role Access grants.
Namespace
Drupal\racCode
public function permissions() {
$ops = [
'view',
'update',
];
$permissions = [];
$roles = user_roles();
foreach ($ops as $op) {
foreach ($roles as $role) {
$permission = "RAC_" . $op . "_" . $role
->id();
$permissions[$permission] = [
'title' => $this
->t("@op Content for Role @label", [
'@op' => $op,
'@label' => $role
->label(),
]),
'restrict access' => TRUE,
];
}
}
return $permissions;
}