File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
invenio_records_permissions Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -428,6 +428,16 @@ class RecordPermissionPolicy(BasePermissionPolicy):
428428 same permissions as ``can_edit``. If you later modify ``can_edit`` or override
429429 it in a subclass, the delegating permissions automatically inherit those changes.
430430
431+ By virtue of operator overloading, ``SameAs`` can also be used outside of lists
432+ to simplify permission policies:
433+
434+ .. code-block:: python
435+
436+ class RecordPermissionPolicy(BasePermissionPolicy):
437+ can_manage = [RecordOwners(), SystemProcess()]
438+ can_curate = SameAs("can_manage") + [AccessGrant("edit")]
439+ can_delete = SameAs("can_curate")
440+
431441 Note:
432442 The permission name must be an attribute on the policy instance and must
433443 contain a list of generators.
You can’t perform that action at this time.
0 commit comments