Default to a NULL administrator, instead of the same as the owner
authorEvan Broder <broder@mit.edu>
Mon, 17 Nov 2008 19:08:04 +0000 (14:08 -0500)
committerEvan Broder <broder@mit.edu>
Mon, 17 Nov 2008 19:08:04 +0000 (14:08 -0500)
svn path=/trunk/packages/invirt-web/; revision=1709

code/cache_acls.py
code/controls.py
code/validation.py

index 1a23587..7634b7e 100644 (file)
@@ -42,7 +42,8 @@ def expandName(name):
 def accessList(m):
     people = set()
     people.update(expandLocker(m.owner))
 def accessList(m):
     people = set()
     people.update(expandLocker(m.owner))
-    people.update(expandName(m.administrator))
+    if m.administrator is not None:
+        people.update(expandName(m.administrator))
     return people
 
 def refreshMachine(m):
     return people
 
 def refreshMachine(m):
index 7f5a630..d152627 100644 (file)
@@ -90,7 +90,7 @@ def createVm(username, state, owner, contact, name, description, memory, disksiz
         machine.description = description
         machine.memory = memory
         machine.owner = owner
         machine.description = description
         machine.memory = memory
         machine.owner = owner
-        machine.administrator = owner
+        machine.administrator = None
         machine.contact = contact
         machine.uuid = uuidToString(randomUUID())
         machine.boot_off_cd = True
         machine.contact = contact
         machine.uuid = uuidToString(randomUUID())
         machine.boot_off_cd = True
index fe6d7c8..ecd8b9f 100644 (file)
@@ -44,9 +44,7 @@ class Validate:
         owner = testOwner(username, owner, machine)
         if owner is not None:
             self.owner = owner
         owner = testOwner(username, owner, machine)
         if owner is not None:
             self.owner = owner
-        admin = testAdmin(username, admin, machine)
-        if admin is not None:
-            self.admin = admin
+        self.admin = testAdmin(username, admin, machine)
         contact = testContact(username, contact, machine)
         if contact is not None:
             self.contact = contact
         contact = testContact(username, contact, machine)
         if contact is not None:
             self.contact = contact
@@ -218,7 +216,7 @@ def testAdmin(user, admin, machine):
     if admin is None:
         return None
     if machine is not None and admin == machine.administrator:
     if admin is None:
         return None
     if machine is not None and admin == machine.administrator:
-        return None
+        return admin
     if admin == user:
         return admin
     if ':' not in admin:
     if admin == user:
         return admin
     if ':' not in admin: