Simple ACL library for Python with middleware
Python
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
simpleacl
.gitignore
.travis.yml
AUTHORS.md
INSTALL
LICENSE
README.md
changelog
setup.py Removed stale download_url from setup.py Mar 1, 2014

README.md

Build Status

Simpleacl

Instructions for simpleacl Acl class

>>> import simpleacl
>>> acl = simpleacl.Acl()
>>> acl.add_role('admin')
>>> acl.add_role('member')
>>> acl.add_role('guest')
>>> acl.add_privilege('view_page')
>>> acl.add_privilege('edit_page')
>>> acl.add_privilege('delete_page')
>>> acl.allow('admin', 'all')
>>> acl.allow('member', ['view_page', 'edit_page'])
>>> acl.allow('guest', 'view_page')
>>> # set who the active role based on what the user is.
>>> acl.active_role_is('member')
>>> # check if the user is allowed to the privilege
>>> acl.is_allowed('edit_page')
True
>>> acl.is_allowed('delete_page')
False