You are here

public function RestPermissions::permissions in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/rest/src/RestPermissions.php \Drupal\rest\RestPermissions::permissions()

Returns an array of REST permissions.

Return value

array

1 string reference to 'RestPermissions::permissions'
rest.permissions.yml in core/modules/rest/rest.permissions.yml
core/modules/rest/rest.permissions.yml

File

core/modules/rest/src/RestPermissions.php, line 59
Contains \Drupal\rest\RestPermissions.

Class

RestPermissions
Provides rest module permissions.

Namespace

Drupal\rest

Code

public function permissions() {
  $permissions = [];
  $resources = $this->configFactory
    ->get('rest.settings')
    ->get('resources');
  if ($resources && ($enabled = array_intersect_key($this->restPluginManager
    ->getDefinitions(), $resources))) {
    foreach ($enabled as $key => $resource) {
      $plugin = $this->restPluginManager
        ->getInstance([
        'id' => $key,
      ]);
      $permissions = array_merge($permissions, $plugin
        ->permissions());
    }
  }
  return $permissions;
}