Skip to content

Commit

Permalink
Policies: prevent changing or removing replication or revision metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
lwesterhof committed Oct 26, 2023
1 parent 307e9ee commit c9faab9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,16 @@ def py_acPreProcForModifyAVUMetadata(ctx, option, obj_type, obj_name, attr, valu

return policies_folder_status.pre_status_transition(ctx, obj_name, x[0], x[1])

elif (space in [pathutil.Space.RESEARCH, pathutil.Space.DEPOSIT]
and attr in [constants.UUORGMETADATAPREFIX + "revision_scheduled",
constants.UUORGMETADATAPREFIX + "replication_scheduled"]):
# Research or deposit orginizational metadata.
if user.is_admin(ctx, actor):
return policy.succeed()

if option not in ['add']:
return policy.fail('Only "add" operations allowed on attribute')

elif space is pathutil.Space.VAULT and attr == constants.IIVAULTSTATUSATTRNAME:
if not user.is_admin(ctx, actor):
return policy.fail('No permission to change vault status')
Expand Down

0 comments on commit c9faab9

Please sign in to comment.