Exemplo n.º 1
0
def require(permission):
    if (not 'auth' in cherrypy.request.cookie
        ) or cherrypy.request.cookie['auth'].value not in auth.Tokens:
        raise cherrypy.HTTPRedirect("/login/")
    if not auth.checkTokenPermission(cherrypy.request.cookie['auth'].value,
                                     permission):
        raise cherrypy.HTTPRedirect("/errors/permissionerror")
Exemplo n.º 2
0
 def index(self, *path, **data):
     #Was there a reason not to use pages.require
     if 'auth' in cherrypy.request.cookie.keys():
         if auth.checkTokenPermission(cherrypy.request.cookie['auth'].value,
                                      "/admin/mainpage.view"):
             return pages.get_template('index.html').render(
                 user=cherrypy.request.cookie['user'].value, )
     return self.login.index()
Exemplo n.º 3
0
 def index(self,*path,**data):
     #Was there a reason not to use pages.require
     if 'auth' in cherrypy.request.cookie.keys():
         if auth.checkTokenPermission(cherrypy.request.cookie['auth'].value,"/admin/mainpage.view"):
             return pages.get_template('index.html').render(
             user = cherrypy.request.cookie['user'].value,
                             )
     return self.login.index()
Exemplo n.º 4
0
def require(permission):
    if (not 'auth' in cherrypy.request.cookie) or cherrypy.request.cookie['auth'].value not in auth.Tokens:
       raise cherrypy.HTTPRedirect("/login/")
    if not auth.checkTokenPermission(cherrypy.request.cookie['auth'].value,permission):
        raise cherrypy.HTTPRedirect("/errors/permissionerror")