-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate permissions for all entity operations #222
Comments
I researched this today and this doesn't seem to be possible in core today. Our best bet will be to use the Entity Operations module once it is ported to Drupal 8. For more information, see https://www.drupal.org/node/2744683#comment-11274521 |
Not a big fan of a hard dependency. So we could add permissions for core
|
Yes that sounds like a good plan. For the moment I am going to put an alter hook in, so any module can supply support for their own entity operations. My immediate need for this is the OG Menu module, which has a special 'add menu item' operation. |
Note that this is a long term plan, this issue is not actionable today. It can only be worked on as soon as support for formalized access control on entity operations is added to Drupal core, or provided by a contrib module such as Entity Operations. |
Drupal core 9.3 now provides a generic access API for node and media revisions. We should add revision permissions, see Gizra#736. |
Currently we only generate permissions for the standard CRUD operations 'create', 'update', 'view' and 'delete' in
PermissionManager::generateCrudPermissionList()
. Modules can change the available operations for different entity types usinghook_entity_permission()
andhook_entity_permission_alter()
. This means that the full 4 CRUD operations might not be available, or new operations might be added at will.Some examples are the Content Translation module which adds a 'translate' operation, and the OG Menu module which adds an 'add link' operation.
We currently use the pattern of providing two permissions for each operation, depending on whether or not the user owns the entity which is being operated upon (e.g. 'delete all entities' vs 'delete own entities'). It would be good to continue this pattern for all operations for now, even though there are cases where this doesn't make sense.
We will also need to rename the existing permissions to accommodate the new flexibility. It will need to become something akin to
perform the $operation operation on $entity_type_id entities of type $bundle_id
.Since these auto-generated permissions and their labels are quite wordy and not human-friendly it would also be great to provide an alter hook so the automatically generated permissions can be tweaked, and perhaps even a 'provider hook' so modules can opt to provide their own set of permissions instead of the auto generated ones.
The text was updated successfully, but these errors were encountered: