Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 20 lines (17 sloc) 0.484 kB
0120957 @parente Copyrights
authored
1 '''
2 Allowed users and their roles.
3
4 Copyright (c) 2010, 2011 Peter Parente. All Rights Reserved.
5 '''
4bcab21 @parente Simple authn and authz
authored
6 # tornado
7 import tornado.web
8
9 allowed = {
10 'parente@gmail.com' : 'admin'
11 }
12
13 def requireRole(role='admin'):
14 def wrap(method):
15 def wrapped_m(self, *args, **kwargs):
16 if allowed.get(self.current_user, '') != role:
17 raise tornado.web.HTTPError(403)
18 return method(self, *args, **kwargs)
19 return wrapped_m
20 return wrap
Something went wrong with that request. Please try again.