import userauth
from userauth import authorize, UserAuth
import cherrypy
import os
class Root():
@cherrypy.expose
def index(self):
return "This is always accessible by anyone."
class Members(UserAuth):
""" Unless otherwise stated (secret()), no pages under this
module will be viewable by any member outside of the
members and admins groups.
"""
_db = 'sqlite:' + os.path.abspath('filename.db')
_authorized = ['members', 'admins']
_unauthorized = '/login'
@cherrypy.expose
def index(self):
return "You're only here if you are a member!"
@authorize(['secret'], '/nowhere')
@cherrypy.expose
def secret(self):
# It would work to just make this another section all-together, but
# it could be useful...
return "Only members of secret can access this..."
cherrypy.root = Root()
cherrypy.root.members = Members()
August 2005 September 2005 October 2005 November 2005 December 2005 January 2006 February 2006 March 2006 April 2006 June 2006 July 2006 August 2006 September 2006 October 2006 November 2006