X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/92bbb6ddedd2d02abb7e1289f0a50827429593d5..1b3bce36430d275a1b9148fb63ba601b43c4c1db:/templates/getafsgroups.py diff --git a/templates/getafsgroups.py b/templates/getafsgroups.py index c98f708..2086ccb 100644 --- a/templates/getafsgroups.py +++ b/templates/getafsgroups.py @@ -39,7 +39,10 @@ def checkAfsGroup(user, group, cell): def checkLockerOwner(user, locker, verbose=False): """ - checkLockerOwner(user, locker) returns True if and only if user administers locker + checkLockerOwner(user, locker) returns True if and only if user administers locker. + + If verbose is true, instead return the reason for failure, or None + if there is no failure. """ p = subprocess.Popen(["fs", "whichcell", "/mit/" + locker], stdout=subprocess.PIPE, stderr=subprocess.PIPE) @@ -61,6 +64,8 @@ def checkLockerOwner(user, locker, verbose=False): if entry[1] == "rlidwka": if entry[0] == user or (entry[0][0:6] == "system" and checkAfsGroup(user, entry[0], cell)): + if verbose: + return None return True if verbose: return "You don't have admin bits on /mit/" + locker