##
+
##
# privilege_table is a list of priviliges and what operations are allowed
# per privilege.
"operator": ["gettrustedcerts", "getgids"]}
+
##
# Determine tje rights that an object should have. The rights are entirely
# dependent on the type of the object. For example, users automatically
rl.add("resolve")
rl.add("info")
elif type == "sa":
- rl.add("authority,sa")
+ rl.add("authority")
+ rl.add("sa")
elif type == "ma":
- rl.add("authority,ma")
+ rl.add("authority")
+ rl.add("ma")
elif type == "authority":
- rl.add("authority,sa,ma")
+ rl.add("authority")
+ rl.add("sa")
+ rl.add("ma")
elif type == "slice":
rl.add("refresh")
rl.add("embed")
def add(self, right, delegate=False):
if isinstance(right, str):
- right = Right(kind = right, delegate=delegate)
+ right = Right(right, delegate)
self.rights.append(right)
##
for part in parts:
if ':' in part:
spl = part.split(':')
- kind = spl[0]
- delegate = int(spl[1])
+ kind = spl[0].strip()
+ delegate = bool(int(spl[1]))
else:
- kind = part
+ kind = part.strip()
delegate = 0
self.rights.append(Right(kind, bool(delegate)))
def save_to_string(self):
right_names = []
for right in self.rights:
- right_names.append('%s:%d' % (right.kind, right.delegate))
+ right_names.append('%s:%d' % (right.kind.strip(), right.delegate))
return ",".join(right_names)