33# Copyright (C) 2021 CERN.
44# Copyright (C) 2021 Northwestern University.
55# Copyright (C) 2021 TU Wien.
6+ # Copyright (C) 2026 CESNET, z.s.p.o.
67#
78# Invenio-Requests is free software; you can redistribute it and/or
89# modify it under the terms of the MIT License; see LICENSE file for more
1718 AuthenticatedUser ,
1819 Disable ,
1920 IfConfig ,
21+ SameAs ,
2022 SystemProcess ,
2123 SystemProcessWithoutSuperUser ,
2224)
@@ -32,7 +34,7 @@ class PermissionPolicy(RecordPermissionPolicy):
3234 # Just about ability to perform a search (not what requests you can access)
3335 can_search = [AuthenticatedUser (), SystemProcess ()]
3436
35- can_search_user_requests = can_search
37+ can_search_user_requests = SameAs ( " can_search" )
3638
3739 # Read/update/delete action deals with requests in **multiple states**, and
3840 # thus must take the request status into account.
@@ -76,13 +78,13 @@ class PermissionPolicy(RecordPermissionPolicy):
7678 # with requests in a **single state** and thus doesn't need to take the
7779 # request status into account.
7880 can_action_submit = [Creator (), SystemProcess ()]
79- can_action_cancel = [ Creator (), SystemProcess ()]
81+ can_action_cancel = SameAs ( "can_action_submit" )
8082 # `SystemProcessWithoutSuperUser`: expire is an automatic action done only by
8183 # the system, therefore the `superuser-action` must be explicitly excluded
8284 # as it's added by default to any permission.
8385 can_action_expire = [SystemProcessWithoutSuperUser ()]
8486 can_action_accept = [Receiver (), SystemProcess ()]
85- can_action_decline = [ Receiver (), SystemProcess ()]
87+ can_action_decline = SameAs ( "can_action_accept" )
8688
8789 can_lock_request = [
8890 IfConfig (
@@ -115,16 +117,16 @@ class PermissionPolicy(RecordPermissionPolicy):
115117 then_ = [
116118 IfLocked (
117119 then_ = [Administration ()],
118- else_ = can_read ,
120+ else_ = SameAs ( " can_read" ) ,
119121 ),
120122 SystemProcess (),
121123 ],
122- else_ = can_read ,
124+ else_ = SameAs ( " can_read" ) ,
123125 ),
124126 ]
125127
126128 # If you can create a comment, you can reply to a comment.
127- can_reply_comment = can_create_comment
129+ can_reply_comment = SameAs ( " can_create_comment" )
128130
129131 # Needed by the search events permission because a permission_action must
130132 # be provided to create_search(), but the event search is already protected
0 commit comments