Changeset 263
- Timestamp:
- Jan 29, 2008, 11:35:48 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/web/cache_acls.py
r262 r263 31 31 return getafsgroups.getAfsGroupMembers(name, 'athena.mit.edu') 32 32 33 def refreshMachine(m): 34 people = set() 35 people.update(expandLocker(m.owner)) 36 people.update(expandName(m.administrator)) 37 old_people = set(a.user for a in m.acl) 38 for removed in old_people - people: 39 ma = [x for x in m.acl if x.user == removed][0] 40 ctx.current.delete(ma) 41 for p in people - old_people: 42 ma = MachineAccess(machine_id=m.machine_id, user=p) 43 ctx.current.save(ma) 44 33 45 def refreshCache(): 34 46 transaction = ctx.current.create_transaction() … … 37 49 machines = Machine.select() 38 50 for m in machines: 39 people = set() 40 people.update(expandLocker(m.owner)) 41 people.update(expandName(m.administrator)) 42 print '%s: %s' % (m.name, ' '.join(people)) 43 old_people = set(a.user for a in m.acl) 44 for removed in old_people - people: 45 ma = [x for x in m.acl if x.user == removed][0] 46 ctx.current.delete(ma) 47 for p in people - old_people: 48 ma = MachineAccess(machine_id=m.machine_id, user=p) 49 ctx.current.save(ma) 50 ctx.current.flush() 51 refreshMachine(m) 52 ctx.current.flush() 51 53 52 54 # Atomically execute our changes
Note: See TracChangeset
for help on using the changeset viewer.