From 8ec75d063f13ad72a7e2ce7ed17b33b8f839628b Mon Sep 17 00:00:00 2001 From: Chun Ly Date: Thu, 10 Sep 2020 08:33:07 -0700 Subject: [PATCH] get_current_groups: Add revert_command in log #52 --- requiam/manual_override.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/requiam/manual_override.py b/requiam/manual_override.py index d4139750..450119b9 100644 --- a/requiam/manual_override.py +++ b/requiam/manual_override.py @@ -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: @@ -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))] @@ -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))] @@ -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