Start tracking the membership of the adminacl setting in the admins table.
authorEvan Broder <broder@mit.edu>
Sat, 28 Feb 2009 01:46:23 +0000 (20:46 -0500)
committerEvan Broder <broder@mit.edu>
Sat, 28 Feb 2009 01:46:23 +0000 (20:46 -0500)
svn path=/trunk/packages/invirt-web/; revision=2223

code/cache_acls.py [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index fe69815..e18b3d0
@@ -70,6 +70,16 @@ def refreshCache():
             refreshMachine(m)
         session.flush()
             
             refreshMachine(m)
         session.flush()
             
+        # Update the admin ACL as well
+        admin_acl = set(expandName(config.adminacl))
+        old_admin_acl = set(a.user for a in Admin.query())
+        for removed in old_admin_acl - admin_acl:
+            Admin.query.filter_by(user=removed).delete()
+        for added in admin_acl - old_admin_acl:
+            a = Admin(user=added)
+            session.save_or_update(a)
+        session.flush()
+    
         # Atomically execute our changes
         session.commit()
     except:
         # Atomically execute our changes
         session.commit()
     except: