X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/5d070af36a7da6e1b25023ae96b30d66573343dc..102769b5296d5a4895fff466def7c99f8a255fb3:/templates/getafsgroups.py?ds=sidebyside 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