You are here

protected function DeveloperAppPermissionProvider::buildEntityTypePermissions in Apigee Edge 8

Builds permissions for the entity_type granularity.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.

Return value

array The permissions.

Overrides UncacheableEntityPermissionProvider::buildEntityTypePermissions

File

src/Entity/DeveloperAppPermissionProvider.php, line 32

Class

DeveloperAppPermissionProvider
Permission provider for developer app entities.

Namespace

Drupal\apigee_edge\Entity

Code

protected function buildEntityTypePermissions(EntityTypeInterface $entity_type) {
  $permissions = parent::buildEntityTypePermissions($entity_type);
  $entity_type_id = $entity_type
    ->id();
  $permissions["analytics any {$entity_type_id}"] = [
    'title' => $this
      ->t('View any @type analytics', [
      '@type' => $entity_type
        ->getSingularLabel(),
    ]),
  ];
  $permissions["analytics own {$entity_type_id}"] = [
    'title' => $this
      ->t('View own @type analytics', [
      '@type' => $entity_type
        ->getPluralLabel(),
    ]),
  ];
  $permissions["add_api_key own {$entity_type_id}"] = [
    'title' => $this
      ->t('Add API key to own @type', [
      '@type' => $entity_type
        ->getPluralLabel(),
    ]),
  ];
  $permissions["add_api_key any {$entity_type_id}"] = [
    'title' => $this
      ->t('Add API key to any @type', [
      '@type' => $entity_type
        ->getPluralLabel(),
    ]),
  ];
  $permissions["revoke_api_key own {$entity_type_id}"] = [
    'title' => $this
      ->t('Revoke API key from own @type', [
      '@type' => $entity_type
        ->getPluralLabel(),
    ]),
  ];
  $permissions["revoke_api_key any {$entity_type_id}"] = [
    'title' => $this
      ->t('Revoke API key from any @type', [
      '@type' => $entity_type
        ->getPluralLabel(),
    ]),
  ];
  $permissions["delete_api_key own {$entity_type_id}"] = [
    'title' => $this
      ->t('Delete API key from own @type', [
      '@type' => $entity_type
        ->getPluralLabel(),
    ]),
  ];
  $permissions["delete_api_key any {$entity_type_id}"] = [
    'title' => $this
      ->t('Delete API key from any @type', [
      '@type' => $entity_type
        ->getPluralLabel(),
    ]),
  ];
  $permissions["edit_api_products {$entity_type_id}"] = [
    'title' => $this
      ->t('Edit API products for @type', [
      '@type' => $entity_type
        ->getPluralLabel(),
    ]),
  ];
  return $permissions;
}