2 from invirt.database import *
3 from invirt.config import structs as config
8 def expandLocker(name):
10 groups = getafsgroups.getLockerAcl(name)
11 except getafsgroups.AfsProcessError, e:
12 if e.message.startswith("fs: You don't have the required access rights on"):
16 cell = getafsgroups.getCell(name)
20 ans.update(getafsgroups.getAfsGroupMembers(group, cell))
26 p = subprocess.Popen(['vos', 'examine', 'user.'+name],
27 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
39 return getafsgroups.getAfsGroupMembers(name, config.authz[0].cell)
40 except getafsgroups.AfsProcessError:
45 people.update(expandLocker(m.owner))
46 if m.administrator is not None:
47 people.update(expandName(m.administrator))
50 def refreshMachine(m):
51 people = accessList(m)
52 old_people = set(a.user for a in m.acl)
53 for removed in old_people - people:
54 ma = [x for x in m.acl if x.user == removed][0]
56 for p in people - old_people:
57 ma = MachineAccess(user=p)
59 session.save_or_update(ma)
65 machines = Machine.query().all()
70 # Atomically execute our changes
73 # Failed! Rollback all the changes.
77 if __name__ == '__main__':