You are here

public function FullEntityPermissionProvider::getPermission in Group 2.0.x

Gets the name of the permission for the given operation, target and scope.

Parameters

string $operation: The permission operation. Usually "create", "view", "update" or "delete".

string $target: The target of the operation. Can be 'relation' or 'entity'.

string $scope: (optional) Whether the 'any' or 'own' permission name should be returned. Defaults to 'any'.

Return value

string|false The permission name or FALSE if it does not apply.

Overrides PermissionProviderTrait::getPermission

1 call to FullEntityPermissionProvider::getPermission()
FullEntityPermissionProvider::buildPermissions in tests/modules/group_test_plugin/src/Plugin/Group/RelationHandler/FullEntityPermissionProvider.php
Provides a list of group permissions the plugin exposes.

File

tests/modules/group_test_plugin/src/Plugin/Group/RelationHandler/FullEntityPermissionProvider.php, line 32

Class

FullEntityPermissionProvider
Provides all possible permissions.

Namespace

Drupal\group_test_plugin\Plugin\Group\RelationHandler

Code

public function getPermission($operation, $target, $scope = 'any') {

  // The view permissions support all scopes here.
  if ($target === 'entity') {
    switch ($operation) {
      case 'view':
        return $this
          ->getEntityViewPermission($scope);
      case 'view unpublished':
        return $this
          ->getEntityViewUnpublishedPermission($scope);
    }
  }
  return $this->parent
    ->getPermission($operation, $target, $scope);
}