Skip to content

Commit

Permalink
get_current_groups: Add revert_command in log #52
Browse files Browse the repository at this point in the history
  • Loading branch information
astrochun committed Sep 10, 2020
1 parent ca84e7f commit 8ec75d0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions requiam/manual_override.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ def get_current_groups(uid, ldap_dict, log, verbose=True):
figshare_dict['active'] = False
return figshare_dict

revert_command = f'--netid {uid} '

# Check for active group
active_stem = figshare_stem('active')
if active_stem in membership:
Expand All @@ -250,6 +252,8 @@ def get_current_groups(uid, ldap_dict, log, verbose=True):
log.warning(f"{uid} not member of figshare:active group")
figshare_dict['active'] = False

revert_command += f'--active_remove '

# Extract portal
portal_stem = figshare_stem('portal')
portal = [s for s in membership if ((portal_stem in s) and ('grouper' not in s))]
Expand All @@ -265,6 +269,8 @@ def get_current_groups(uid, ldap_dict, log, verbose=True):
if verbose:
log.info(f"Current portal is : {figshare_dict['portal']}")

revert_command += f"--portal {figshare_dict['portal']} "

# Extract quota
quota_stem = figshare_stem('quota')
quota = [s for s in membership if ((quota_stem in s) and ('grouper' not in s))]
Expand All @@ -280,4 +286,8 @@ def get_current_groups(uid, ldap_dict, log, verbose=True):
if verbose:
log.info(f"Current quota is : {figshare_dict['quota']} bytes")

if len(quota) != 0:
revert_command += f"--quota {figshare_dict['quota']} "

log.info(f"To revert, use: {revert_command}")
return figshare_dict

0 comments on commit 8ec75d0

Please sign in to comment.