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('userdemo',u'系统管理')

@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



```


## 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.

Source Distribution

tor_access-0.2.1.dev.tar.gz (3.5 kB view hashes)

Uploaded Source

Built Distribution

tor_access-0.2.1.dev-py2.7.egg (5.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page