projects
/
invirt/packages/invirt-web.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
oops
[invirt/packages/invirt-web.git]
/
code
/
validation.py
diff --git
a/code/validation.py
b/code/validation.py
index
79fa10c
..
f6e4a59
100644
(file)
--- a/
code/validation.py
+++ b/
code/validation.py
@@
-5,6
+5,7
@@
import getafsgroups
import re
import string
from invirt.database import Machine, NIC, Type, Disk, CDROM, Autoinstall
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
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"""
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"""
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:
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)
return admin
except getafsgroups.AfsProcessError, e:
errmsg = str(e)