sipb-xen-www depends on AFS and python-flup
[invirt/packages/invirt-web.git] / code / validation.py
index 79fa10c..f6e4a59 100644 (file)
@@ -5,6 +5,7 @@ import getafsgroups
 import re
 import string
 from invirt.database import Machine, NIC, Type, Disk, CDROM, Autoinstall
+from invirt.config import structs as config
 from webcommon import InvalidInput
 
 MAX_MEMORY_TOTAL = 512
@@ -125,7 +126,8 @@ def cantAddVm(owner, g):
 
 def haveAccess(user, state, machine):
     """Return whether a user has administrative access to a machine"""
-    return state.isadmin or user in cache_acls.accessList(machine)
+    return (user in cache_acls.accessList(machine)
+            or (machine.adminable and state.isadmin))
 
 def owns(user, machine):
     """Return whether a user owns a machine"""
@@ -222,7 +224,7 @@ def testAdmin(user, admin, machine):
             return admin
         admin = 'system:' + admin
     try:
-        if user in getafsgroups.getAfsGroupMembers(admin, 'athena.mit.edu'):
+        if user in getafsgroups.getAfsGroupMembers(admin, config.authz[0].cell):
             return admin
     except getafsgroups.AfsProcessError, e:
         errmsg = str(e)