public function RestPermissions::permissions in Drupal 9
Same name and namespace in other branches
- 8 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 55
Class
- RestPermissions
- Provides rest module permissions.
Namespace
Drupal\restCode
public function permissions() {
$permissions = [];
/** @var \Drupal\rest\RestResourceConfigInterface[] $resource_configs */
$resource_configs = $this->resourceConfigStorage
->loadMultiple();
foreach ($resource_configs as $resource_config) {
$plugin = $resource_config
->getResourcePlugin();
// Add the rest resource configuration entity as a dependency to the
// permissions.
$permissions += array_map(function (array $permission_info) use ($resource_config) {
$merge_info['dependencies'][$resource_config
->getConfigDependencyKey()] = [
$resource_config
->getConfigDependencyName(),
];
return NestedArray::mergeDeep($permission_info, $merge_info);
}, $plugin
->permissions());
}
return $permissions;
}