X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/python-afs.git/blobdiff_plain/137d9e9aa87890dbd343383f636652374dbd72db..HEAD:/afs/acl.py diff --git a/afs/acl.py b/afs/acl.py index 1fb1dac..20a416f 100644 --- a/afs/acl.py +++ b/afs/acl.py @@ -1,22 +1,24 @@ -import _acl -from _acl import READ, WRITE, INSERT, LOOKUP, DELETE, LOCK, ADMINISTER, \ +from afs import _acl +from afs._acl import READ, WRITE, INSERT, LOOKUP, DELETE, LOCK, ADMINISTER, \ USR0, USR1, USR2, USR3, USR4, USR5, USR6, USR7 -from _acl import getCallerAccess +from afs._acl import getCallerAccess _canonical = { "read": "rl", - "write": "rwlidwk", - "all": "rwlidwka", + "write": "rlidwk", + "all": "rlidwka", "mail": "lik", "none": "", } +_reverseCanonical = dict((y, x) for (x, y) in _canonical.iteritems()) + _charBitAssoc = [ ('r', READ), - ('w', WRITE), - ('i', INSERT), ('l', LOOKUP), + ('i', INSERT), ('d', DELETE), + ('w', WRITE), ('k', LOCK), ('a', ADMINISTER), ('A', USR0), @@ -32,6 +34,13 @@ _charBitAssoc = [ _char2bit = dict(_charBitAssoc) +def rightsToEnglish(s): + """Turns a rlwidwka string into a canonical name if possible""" + if s in _reverseCanonical: + return _reverseCanonical[s] + else: + return '' + def readRights(s): """Canonicalizes string rights to bitmask""" if s in _canonical: s = _canonical[s]