Changeset 260


Ignore:
Timestamp:
Jan 24, 2008, 9:32:42 PM (16 years ago)
Author:
ecprice
Message:

Only update the differences (and actually work).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/web/cache_acls.py

    r257 r260  
    3636    transaction = ctx.current.create_transaction()
    3737
    38     print repr(ctx), repr(ctx.current), repr(transaction)
    39     # Remove existing machine access entries
    40     machine_access_table.delete()
    41     ctx.current.flush()
    42 
    4338    try:
    4439        machines = Machine.select()
     
    4843            people.update(expandName(m.administrator))
    4944            print '%s: %s' % (m.name, ' '.join(people))
    50             for p in people:
     45            old_people = set(a.user for a in m.acl)
     46            for removed in old_people - people:
     47                ma = [x for x in m.acl if x.user == removed][0]
     48                ctx.current.delete(ma)
     49            for p in people - old_people:
    5150                ma = MachineAccess(machine_id=m.machine_id, user=p)
    5251                ctx.current.save(ma)
Note: See TracChangeset for help on using the changeset viewer.