final class TeamPermissionProvider in Apigee Edge 8
Permission provider for Team entities.
Hierarchy
- class \Drupal\apigee_edge_teams\Entity\TeamPermissionProvider implements EntityPermissionProviderInterface uses StringTranslationTrait
Expanded class hierarchy of TeamPermissionProvider
File
- modules/
apigee_edge_teams/ src/ Entity/ TeamPermissionProvider.php, line 30
Namespace
Drupal\apigee_edge_teams\EntityView source
final class TeamPermissionProvider implements EntityPermissionProviderInterface {
use StringTranslationTrait;
/**
* {@inheritdoc}
*/
public function buildPermissions(EntityTypeInterface $entity_type) {
$permissions = [];
$entity_type_id = $entity_type
->id();
$singular_label = $entity_type
->getSingularLabel();
$plural_label = $entity_type
->getPluralLabel();
$permissions["administer {$entity_type_id}"] = [
'title' => $this
->t('Administer @type', [
'@type' => $plural_label,
]),
'description' => $this
->t('Administer module configure and manage any team and team apps.'),
'restrict access' => TRUE,
];
$permissions["manage {$entity_type_id} members"] = [
'title' => $this
->t('Manage @type members', [
'@type' => $singular_label,
]),
'restrict access' => TRUE,
];
$permissions["view any {$entity_type_id}"] = [
'title' => $this
->t('View any @type', [
'@type' => $plural_label,
]),
];
$permissions["create {$entity_type_id}"] = [
'title' => $this
->t('Create @type', [
'@type' => $plural_label,
]),
];
$permissions["update any {$entity_type_id}"] = [
'title' => $this
->t('Update any @type', [
'@type' => $singular_label,
]),
];
$permissions["delete any {$entity_type_id}"] = [
'title' => $this
->t('Delete any @type', [
'@type' => $singular_label,
]),
];
foreach ($permissions as $name => $permission) {
$permissions[$name]['provider'] = $entity_type
->getProvider();
// TranslatableMarkup objects don't sort properly.
$permissions[$name]['title'] = (string) $permission['title'];
}
return $permissions;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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. | |
TeamPermissionProvider:: |
public | function |
Builds permissions for the given entity type. Overrides EntityPermissionProviderInterface:: |