public function Permissions::eventProxyRolePermissions in RNG - Events and Registrations 3.x
Same name and namespace in other branches
- 8.2 src/Permissions.php \Drupal\rng\Permissions::eventProxyRolePermissions()
- 8 src/Permissions.php \Drupal\rng\Permissions::eventProxyRolePermissions()
Define permissions for proxy registrations by role.
Return value
array
1 string reference to 'Permissions::eventProxyRolePermissions'
File
- src/
Permissions.php, line 19
Class
- Permissions
- Define a permission generator.
Namespace
Drupal\rngCode
public function eventProxyRolePermissions() {
$permissions = [];
$permissions['rng register self'] = [
'title' => $this
->t('Register self'),
'description' => $this
->t('Can register the logged-in user.'),
];
foreach (user_roles(TRUE) as $role) {
$role_id = $role
->id();
$t_args = [
'%role_name' => $role
->label(),
];
$permissions["rng register role {$role_id}"] = [
'title' => $this
->t('Register users with role: %role_name', $t_args),
'description' => $this
->t('Can register other users with this role.'),
];
}
return $permissions;
}