Changeset 867
- Timestamp:
- Aug 4, 2008, 11:20:25 PM (16 years ago)
- Location:
- trunk/packages/sipb-xen-www
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-www/code/main.py
r866 r867 596 596 return templates.unauth(searchList=[{'simple' : True}]) 597 597 598 def overlord(username, state, path, fields):598 def admin(username, state, path, fields): 599 599 if path == '': 600 600 return ({'Status': '303 See Other', 601 'Location': ' overlord/'},601 'Location': 'admin/'}, 602 602 "You shouldn't see this message.") 603 603 if not username in getAfsGroupMembers('system:xvm', 'athena.mit.edu'): 604 raise InvalidInput('username', username, 'Not an overlord.') 605 newstate = State(username, overlord=True) 604 raise InvalidInput('username', username, 605 'Not in admin group %s.' % 'system:xvm') 606 newstate = State(username, isadmin=True) 606 607 newstate.environ = state.environ 607 608 return handler(username, newstate, path, fields) … … 619 620 help=helpHandler, 620 621 unauth=unauthFront, 621 overlord=overlord,622 admin=admin, 622 623 errortest=throwError) 623 624 -
trunk/packages/sipb-xen-www/code/validation.py
r865 r867 126 126 def haveAccess(user, state, machine): 127 127 """Return whether a user has administrative access to a machine""" 128 return state. overlordor user in cache_acls.accessList(machine)128 return state.isadmin or user in cache_acls.accessList(machine) 129 129 130 130 def owns(user, machine): … … 158 158 "Minimum %s MiB" % MIN_MEMORY_SINGLE) 159 159 max_val = maxMemory(owner, g, machine, on) 160 if not g. overlordand memory > max_val:160 if not g.isadmin and memory > max_val: 161 161 raise InvalidInput('memory', memory, 162 162 'Maximum %s MiB for %s' % (max_val, owner)) … … 167 167 try: 168 168 disk = float(disk) 169 if not g. overlordand disk > maxDisk(owner, machine):169 if not g.isadmin and disk > maxDisk(owner, machine): 170 170 raise InvalidInput('disk', disk, 171 171 "Maximum %s G" % maxDisk(owner, machine)) -
trunk/packages/sipb-xen-www/code/webcommon.py
r864 r867 39 39 class State(object): 40 40 """State for a request""" 41 def __init__(self, user, overlord=False):41 def __init__(self, user, isadmin=False): 42 42 self.username = user 43 self. overlord = overlord43 self.isadmin = isadmin 44 44 45 45 def getMachines(self): 46 if self. overlord:46 if self.isadmin: 47 47 return Machine.select() 48 48 else: -
trunk/packages/sipb-xen-www/files/etc/apache2/sites-available/default
r848 r867 13 13 RewriteEngine On 14 14 RewriteRule ^/static(.*) - [L] 15 RewriteRule ^/ overlord/static(.*) /static/$1 [L]15 RewriteRule ^/admin/static(.*) /static/$1 [L] 16 16 RewriteRule ^/trac.fcgi(.*) - [L] 17 17 RewriteRule ^/trac/chrome/common(.*) /usr/share/trac/htdocs$1 [L] -
trunk/packages/sipb-xen-www/files/etc/apache2/sites-available/ssl
r848 r867 20 20 RewriteRule ^/favicon.ico - [L] 21 21 RewriteRule ^/static(.*) - [L] 22 RewriteRule ^/ overlord/static(.*) /static/$1 [L]22 RewriteRule ^/admin/static(.*) /static/$1 [L] 23 23 RewriteRule ^/trac.fcgi(.*) - [L] 24 24 RewriteRule ^/trac/chrome/common(.*) /usr/share/trac/htdocs$1 [L]
Note: See TracChangeset
for help on using the changeset viewer.