public function DefaultTeamPermissionsProvider::permissions in Apigee Edge 8
Returns team permissions provided by a module.
Return value
\Drupal\apigee_edge_teams\Structure\TeamPermission[] Array of team permissions.
Overrides DynamicTeamPermissionProviderInterface::permissions
See also
\Drupal\apigee_edge_teams\TeamPermissionHandlerInterface
File
- modules/
apigee_edge_teams/ src/ DefaultTeamPermissionsProvider.php, line 56
Class
- DefaultTeamPermissionsProvider
- Provides the default team permissions.
Namespace
Drupal\apigee_edge_teamsCode
public function permissions() : array {
$permissions = [];
$operations = [
'team' => [
'label' => $this
->t('Team'),
'permissions' => [
'manage_members' => [
'label' => $this
->t('Manage team members and invitations'),
'description' => $this
->t('Add/remove team members and administer team invitations.'),
],
],
],
'team_app' => [
'label' => $this
->t('Team apps'),
'permissions' => [
'view' => $this
->t('View Team Apps'),
'create' => $this
->t('Create Team Apps'),
'update' => $this
->t('Edit any Team Apps'),
'delete' => $this
->t('Delete any Team Apps'),
'analytics' => $this
->t('View analytics of any Team Apps'),
'add_api_key' => $this
->t('Add API key to Team Apps'),
'revoke_api_key' => $this
->t('Revoke API key from Team Apps'),
'delete_api_key' => $this
->t('Delete API key from Team Apps'),
'edit_api_products' => $this
->t('Edit API products for Team Apps'),
],
],
'api_product' => [
'label' => $this
->t('API products'),
'permissions' => [
'access_public' => $this
->t('View and assign public API products to team apps'),
'access_private' => $this
->t('View and assign private API products to team apps'),
'access_internal' => $this
->t('View and assign internal API products to team apps'),
],
],
];
foreach ($operations as $group => $group_def) {
foreach ($group_def['permissions'] as $operation => $operation_def) {
$description = NULL;
if (is_array($operation_def)) {
$label = $operation_def['label'];
$description = $operation_def['description'] ?? NULL;
}
else {
$label = $operation_def;
}
$name = "{$group}_{$operation}";
$permissions[$name] = new TeamPermission($name, $label, $group_def['label'], $description);
}
}
return $permissions;
}