Skip to content

kyleterry/simpleacl-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Simple ACL library for Python with middleware

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages