2 from invirt.database import *
3 from invirt.config import structs as config
4 from invirt import authz
8 people.update(authz.expandOwner(m.owner))
9 if m.administrator is not None:
10 people.update(authz.expandAdmin(m.administrator))
13 def refreshMachine(m):
14 people = accessList(m)
15 old_people = set(a.user for a in m.acl)
16 for removed in old_people - people:
17 ma = [x for x in m.acl if x.user == removed][0]
19 for p in people - old_people:
20 ma = MachineAccess(user=p)
28 machines = Machine.query.all()
33 # Update the admin ACL as well
34 admin_acl = set(authz.expandAdmin(config.adminacl))
35 old_admin_acl = set(a.user for a in Admin.query)
36 for removed in old_admin_acl - admin_acl:
37 old = Admin.query.filter_by(user=removed).first()
39 for added in admin_acl - old_admin_acl:
44 # Atomically execute our changes
47 # Failed! Rollback all the changes.
51 if __name__ == '__main__':