You are here

public function EntityAccess::workspacePermissions in Workspace 8

Returns an array of workspace-specific permissions.

Note: This approach assumes that a site will have only a small number of workspace entities, under a dozen. If there are many dozens of workspaces defined then this approach will have scaling issues.

Return value

array The workspace permissions.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

File

src/EntityAccess.php, line 177

Class

EntityAccess
Service wrapper for hooks relating to entity access control.

Namespace

Drupal\workspace

Code

public function workspacePermissions() {
  $perms = [];
  foreach ($this
    ->getAllWorkspaces() as $workspace) {
    $perms += $this
      ->createWorkspaceViewPermission($workspace) + $this
      ->createWorkspaceEditPermission($workspace) + $this
      ->createWorkspaceDeletePermission($workspace) + $this
      ->createWorkspaceBypassPermission($workspace);
  }
  return $perms;
}