Skip to main content

User role access for tornado

Project description

tor_access
==========

Tornado access lib for user role


## How to collect access node in tornado
```
import tor_access

@tor_access.needcheck(url=True)
class IndexHandler(tornado.web.RequestHandler):
def get(self):
pass



aclgroup = tor_access.ACLGroupNode(u'系统管理', category='category')

@tor_access.needcheck(url=True, group=aclgroup)
class UserHandler(tornado.web.RequestHandler):
def get(self):
pass



@tor_access.needcheck(url=True, category='categroyname')
class UserInfoHandler(tornado.web.RequestHandler):
def get(self):
pass


OR: aclgroup.fetch_handlers(UserHandler,UserInfoHandler) to add access node
```


## How to get access node
```
import tor_access

acl = tor_access.ACL

```

## How to user Role and check access in Handler
```
import tor_access


@tor_access.needcheck(url=True)
class IndexHandler(tornado.web.RequestHandler):
def prepare(self):
mrn = tor_access.MasterRoleNeed() # 超管角色;有所有的权限节点
rn = tor_access.RoleNeed('abcrole',intro=u'普通角色',nodes=set(['restful.index.IndexHandler','userdemo']))
self.check_access(rn)


```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tor_access, version 0.5.2
Filename, size File type Python version Upload date Hashes
Filename, size tor_access-0.5.2-py2.7.egg (6.6 kB) File type Egg Python version 2.7 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page