Skip to content

Commit

Permalink
Merge pull request #746 from dynamic-entropy/modify_add_did_perm
Browse files Browse the repository at this point in the history
Allow non USER datatier in non cms scopes for admin accounts
  • Loading branch information
dynamic-entropy authored Mar 14, 2024
2 parents 955f9f4 + 95f121f commit 8b4deed
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 8b4deed

Please sign in to comment.