Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

20 lines (17 sloc) 0.484 kb
Allowed users and their roles.
Copyright (c) 2010, 2011 Peter Parente. All Rights Reserved.
# tornado
import tornado.web
allowed = {
'' : 'admin'
def requireRole(role='admin'):
def wrap(method):
def wrapped_m(self, *args, **kwargs):
if allowed.get(self.current_user, '') != role:
raise tornado.web.HTTPError(403)
return method(self, *args, **kwargs)
return wrapped_m
return wrap
Jump to Line
Something went wrong with that request. Please try again.