Skip to content

Commit

Permalink
Allow non USER datatier in non cms scopes for admin accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
dynamic-entropy committed Mar 14, 2024
1 parent 955f9f4 commit 95f121f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/policy/CMSRucioPolicy/permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ def perm_add_did(issuer, kwargs, *, session: "Optional[Session]" = None):
if rule['account'] != issuer:
return False

if kwargs['scope'].external != u'cms':
if kwargs['scope'].external != 'cms' and not has_account_attribute(account=issuer, key='admin', session=session):
if kwargs['type'] == 'DATASET':
if '/USER#' not in kwargs['name']:
return False
Expand All @@ -597,6 +597,8 @@ def perm_add_dids(issuer, kwargs, *, session: "Optional[Session]" = None):
:param session: The DB session to use
:returns: True if account is allowed, otherwise False
"""
#TODO: Check scope ownership for bulk add operation too

# Check the accounts of the issued rules
if not _is_root(issuer) and not has_account_attribute(account=issuer, key='admin', session=session):
for did in kwargs['dids']:
Expand Down

0 comments on commit 95f121f

Please sign in to comment.