You are here

final class TeamAppPermissionProvider in Apigee Edge 8

Permission provider for Team App entities.

Hierarchy

Expanded class hierarchy of TeamAppPermissionProvider

1 file declares its use of TeamAppPermissionProvider
TeamAppListByTeamAccess.php in modules/apigee_edge_teams/src/Access/TeamAppListByTeamAccess.php

File

modules/apigee_edge_teams/src/Entity/TeamAppPermissionProvider.php, line 30

Namespace

Drupal\apigee_edge_teams\Entity
View source
final class TeamAppPermissionProvider implements EntityPermissionProviderInterface {
  use StringTranslationTrait;

  /**
   * The id of the Manage Team Apps permission.
   *
   * @var string
   */
  public const MANAGE_TEAM_APPS_PERMISSION = 'manage team apps';

  /**
   * {@inheritdoc}
   */
  public function buildPermissions(EntityTypeInterface $entity_type) {
    $permissions = [];
    $team_app_plural_label = $entity_type
      ->getPluralLabel();
    $permissions[static::MANAGE_TEAM_APPS_PERMISSION] = [
      'title' => $this
        ->t('Manage @type', [
        '@type' => $team_app_plural_label,
      ]),
      'description' => $this
        ->t('Allows to manage all @team_apps in the system.', [
        '@team_apps' => $team_app_plural_label,
      ]),
      'restrict access' => TRUE,
    ];
    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

Namesort descending Modifiers Type Description Overrides
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
TeamAppPermissionProvider::buildPermissions public function Builds permissions for the given entity type. Overrides EntityPermissionProviderInterface::buildPermissions
TeamAppPermissionProvider::MANAGE_TEAM_APPS_PERMISSION public constant The id of the Manage Team Apps permission.