rename overlord -> admin mode
authorGreg Price <price@mit.edu>
Tue, 5 Aug 2008 03:20:25 +0000 (23:20 -0400)
committerGreg Price <price@mit.edu>
Tue, 5 Aug 2008 03:20:25 +0000 (23:20 -0400)
svn path=/trunk/packages/sipb-xen-www/; revision=867

code/main.py
code/validation.py
code/webcommon.py
files/etc/apache2/sites-available/default
files/etc/apache2/sites-available/ssl

index bb863c1..42a456e 100755 (executable)
@@ -595,14 +595,15 @@ def unauthFront(_, _2, _3, fields):
     """Information for unauth'd users."""
     return templates.unauth(searchList=[{'simple' : True}])
 
-def overlord(username, state, path, fields):
+def admin(username, state, path, fields):
     if path == '':
         return ({'Status': '303 See Other',
-                 'Location': 'overlord/'},
+                 'Location': 'admin/'},
                 "You shouldn't see this message.")
     if not username in getAfsGroupMembers('system:xvm', 'athena.mit.edu'):
-        raise InvalidInput('username', username, 'Not an overlord.')
-    newstate = State(username, overlord=True)
+        raise InvalidInput('username', username,
+                           'Not in admin group %s.' % 'system:xvm')
+    newstate = State(username, isadmin=True)
     newstate.environ = state.environ
     return handler(username, newstate, path, fields)
 
@@ -618,7 +619,7 @@ mapping = dict(list=listVms,
                create=create,
                help=helpHandler,
                unauth=unauthFront,
-               overlord=overlord,
+               admin=admin,
                errortest=throwError)
 
 def printHeaders(headers):
index 817c2cf..79fa10c 100644 (file)
@@ -125,7 +125,7 @@ def cantAddVm(owner, g):
 
 def haveAccess(user, state, machine):
     """Return whether a user has administrative access to a machine"""
-    return state.overlord or user in cache_acls.accessList(machine)
+    return state.isadmin or user in cache_acls.accessList(machine)
 
 def owns(user, machine):
     """Return whether a user owns a machine"""
@@ -157,7 +157,7 @@ def validMemory(owner, g, memory, machine=None, on=True):
         raise InvalidInput('memory', memory,
                            "Minimum %s MiB" % MIN_MEMORY_SINGLE)
     max_val = maxMemory(owner, g, machine, on)
-    if not g.overlord and memory > max_val:
+    if not g.isadmin and memory > max_val:
         raise InvalidInput('memory', memory,
                            'Maximum %s MiB for %s' % (max_val, owner))
     return memory
@@ -166,7 +166,7 @@ def validDisk(owner, g, disk, machine=None):
     """Parse and validate limits for disk for a given owner and machine."""
     try:
         disk = float(disk)
-        if not g.overlord and disk > maxDisk(owner, machine):
+        if not g.isadmin and disk > maxDisk(owner, machine):
             raise InvalidInput('disk', disk,
                                "Maximum %s G" % maxDisk(owner, machine))
         disk = int(disk * 1024)
index 0449046..e82f790 100644 (file)
@@ -38,12 +38,12 @@ def cachedproperty(func):
 
 class State(object):
     """State for a request"""
-    def __init__(self, user, overlord=False):
+    def __init__(self, user, isadmin=False):
         self.username = user
-        self.overlord = overlord
+        self.isadmin = isadmin
 
     def getMachines(self):
-        if self.overlord:
+        if self.isadmin:
             return Machine.select()
         else:
             return Machine.query().join('acl').select_by(user=self.username)
index 1faf9d8..672526c 100644 (file)
@@ -12,7 +12,7 @@ NameVirtualHost *:80
 
        RewriteEngine On
        RewriteRule ^/static(.*) - [L]
-       RewriteRule ^/overlord/static(.*) /static/$1 [L]
+       RewriteRule ^/admin/static(.*) /static/$1 [L]
         RewriteRule ^/trac.fcgi(.*) - [L]
         RewriteRule ^/trac/chrome/common(.*) /usr/share/trac/htdocs$1 [L]
        RewriteRule ^/trac/login(.*) https://xvm.mit.edu/trac/login$1 [L]
index 901d6d6..57aa91d 100644 (file)
@@ -19,7 +19,7 @@
        RewriteEngine On
        RewriteRule ^/favicon.ico - [L]
        RewriteRule ^/static(.*) - [L]
-       RewriteRule ^/overlord/static(.*) /static/$1 [L]
+       RewriteRule ^/admin/static(.*) /static/$1 [L]
        RewriteRule ^/trac.fcgi(.*) - [L]
        RewriteRule ^/trac/chrome/common(.*) /usr/share/trac/htdocs$1 [L]
        RewriteRule ^/trac(.*) /var/www/trac/trac.fcgi$1 [L]