- Timestamp:
- Dec 20, 2009, 9:45:38 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
package_branches/invirt-web/cherrypy-rebased/code/main.py
r2689 r2690 56 56 'from invirt import database'] 57 57 58 def __getattr__(self, name): 59 if name in ("admin", "overlord"): 60 if not cherrypy.request.login in getAfsGroupMembers(config.adminacl, config.authz[0].cell): 61 raise InvalidInput('username', cherrypy.request.login, 62 'Not in admin group %s.' % config.adminacl) 63 cherrypy.request.state = State(cherrypy.request.login, isadmin=True) 64 return self 65 else: 66 return super(InvirtWeb, self).__getattr__(name) 58 67 59 68 @cherrypy.expose … … 646 655 'hostname' : socket.getfqdn()}]) 647 656 648 def admin(username, state, path, fields):649 if path == '':650 return ({'Status': '303 See Other',651 'Location': 'admin/'},652 "You shouldn't see this message.")653 if not username in getAfsGroupMembers(config.adminacl, 'athena.mit.edu'):654 raise InvalidInput('username', username,655 'Not in admin group %s.' % config.adminacl)656 newstate = State(username, isadmin=True)657 newstate.environ = state.environ658 return handler(username, newstate, path, fields)659 660 657 mapping = dict( 661 658 modify=modify, 662 unauth=unauthFront, 663 admin=admin, 664 overlord=admin) 659 unauth=unauthFront) 665 660 666 661 def printHeaders(headers):
Note: See TracChangeset
for help on using the changeset viewer.