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.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

tor_access-0.5.2-py2.7.egg (6.6 kB view details)

Uploaded Source

File details

Details for the file tor_access-0.5.2-py2.7.egg.

File metadata

File hashes

Hashes for tor_access-0.5.2-py2.7.egg
Algorithm Hash digest
SHA256 56105071b237beb9be57552ed54c76d98812dff153aeb791d5b370ad335ddd7f
MD5 e66a4ccc5645895489f6c16f3e293410
BLAKE2b-256 b108d42f7b9170a61043d18fdd6bf93afb1b7c6858279d7914e64ea78d2233e1

See more details on using hashes here.

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