"mail": "lik",
"none": "",
}
-_char2bit = {
- 'r': READ,
- 'w': WRITE,
- 'i': INSERT,
- 'l': LOOKUP,
- 'd': DELETE,
- 'k': LOCK,
- 'a': ADMINISTER,
- 'A': USR0,
- 'B': USR1,
- 'C': USR2,
- 'D': USR3,
- 'E': USR4,
- 'F': USR5,
- 'G': USR6,
- 'H': USR7,
-}
-_bit2char = dict([(v,k) for k,v in _char2bit.items()])
+_charBitAssoc = [
+ ('r', READ),
+ ('w', WRITE),
+ ('i', INSERT),
+ ('l', LOOKUP),
+ ('d', DELETE),
+ ('k', LOCK),
+ ('a', ADMINISTER),
+ ('A', USR0),
+ ('B', USR1),
+ ('C', USR2),
+ ('D', USR3),
+ ('E', USR4),
+ ('F', USR5),
+ ('G', USR6),
+ ('H', USR7),
+]
+
+_char2bit = dict(_charBitAssoc)
+
def crights(s):
"""Canonicalizes string rights to bitmask"""
self.pos = pos
self.neg = neg
@staticmethod
- def retrieve(dir):
+ def retrieve(dir,follow=1):
"""Retrieve the ACL for an AFS directory"""
- pos, neg = _parseAcl(_acl.getAcl(dir))
+ pos, neg = _parseAcl(_acl.getAcl(dir, follow))
return ACL(pos, neg)
+def showRights(r):
+ """Takes a bitmask and returns a rwlidka string"""
+ s = ""
+ for char,mask in _charBitAssoc:
+ if r & mask == mask: s += char
+ return s
+
def _parseRights(s):
"""Parses a rwlid... rights tring to bitmask"""
r = 0