function ResourceBase::permissions
Same name in other branches
- 9 core/modules/rest/src/Plugin/ResourceBase.php \Drupal\rest\Plugin\ResourceBase::permissions()
- 8.9.x core/modules/rest/src/Plugin/ResourceBase.php \Drupal\rest\Plugin\ResourceBase::permissions()
- 10 core/modules/rest/src/Plugin/ResourceBase.php \Drupal\rest\Plugin\ResourceBase::permissions()
Implements ResourceInterface::permissions().
Every plugin operation method gets its own user permission. Example: "restful delete entity:node" with the title "Access DELETE on Node resource".
Overrides ResourceInterface::permissions
2 methods override ResourceBase::permissions()
- EntityResource::permissions in core/
modules/ rest/ src/ Plugin/ rest/ resource/ EntityResource.php - FileUploadResource::permissions in core/
modules/ file/ src/ Plugin/ rest/ resource/ FileUploadResource.php
File
-
core/
modules/ rest/ src/ Plugin/ ResourceBase.php, line 83
Class
- ResourceBase
- Common base class for resource plugins.
Namespace
Drupal\rest\PluginCode
public function permissions() {
$permissions = [];
$definition = $this->getPluginDefinition();
foreach ($this->availableMethods() as $method) {
$lowered_method = strtolower($method);
$permissions["restful {$lowered_method} {$this->pluginId}"] = [
'title' => $this->t('Access @method on %label resource', [
'@method' => $method,
'%label' => $definition['label'],
]),
];
}
return $permissions;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.