You are here

protected function GroupQueryAccessHandler::getPermissionName in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/Access/GroupQueryAccessHandler.php \Drupal\group\Entity\Access\GroupQueryAccessHandler::getPermissionName()

Retrieves the group permission name for the given operation.

Parameters

string $operation: The access operation. Usually one of "view", "update" or "delete".

Return value

string The group permission name.

1 call to GroupQueryAccessHandler::getPermissionName()
GroupQueryAccessHandler::buildConditions in src/Entity/Access/GroupQueryAccessHandler.php
Builds the conditions for the given operation and account.

File

src/Entity/Access/GroupQueryAccessHandler.php, line 25

Class

GroupQueryAccessHandler
Controls query access for group entities.

Namespace

Drupal\group\Entity\Access

Code

protected function getPermissionName($operation) {
  switch ($operation) {

    // @todo Could use the below if permission were named 'update group'.
    case 'update':
      $permission = 'edit group';
      break;
    case 'delete':
    case 'view':
      $permission = "{$operation} group";
      break;
    default:
      $permission = 'view group';
  }
  return $permission;
}