class Permissions in RNG - Events and Registrations 8
Same name and namespace in other branches
- 8.2 src/Permissions.php \Drupal\rng\Permissions
- 3.x src/Permissions.php \Drupal\rng\Permissions
Define a permission generator.
Hierarchy
- class \Drupal\rng\Permissions uses UrlGeneratorTrait, StringTranslationTrait
Expanded class hierarchy of Permissions
File
- src/
Permissions.php, line 11
Namespace
Drupal\rngView source
class Permissions {
use StringTranslationTrait;
use UrlGeneratorTrait;
/**
* Define permissions for proxy registrations by role.
*
* @return array
*/
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Permissions:: |
public | function | Define permissions for proxy registrations by role. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
UrlGeneratorTrait:: |
protected | property | The url generator. | |
UrlGeneratorTrait:: |
protected | function | Returns the URL generator service. | |
UrlGeneratorTrait:: |
protected | function | Returns a redirect response object for the specified route. | 3 |
UrlGeneratorTrait:: |
public | function | Sets the URL generator service. | |
UrlGeneratorTrait:: |
protected | function | Generates a URL or path for a specific route based on the given parameters. |