simple-rbacA simple role based access control utility | |
Download |
simple-rbac Ranking & Summary
Advertisement
- License:
- MIT/X Consortium Lic...
- Price:
- FREE
- Publisher Name:
- TonySeek
- Publisher web site:
- https://github.com/tonyseek/
simple-rbac Tags
simple-rbac Description
simple-rbac is a simple role based access control utility in Python.Quick Start1. Install Simple RBACpip install simple-rbac2. Create a Access Control Listimport rbac.aclacl = rbac.acl.Registry()3. Register Roles and Resourcesacl.add_role("member")acl.add_role("student", )acl.add_role("teacher", )acl.add_role("junior-student", )acl.add_resource("course")acl.add_resource("senior-course", )4. Add Rulesacl.allow("member", "view", "course")acl.allow("student", "learn", "course")acl.allow("teacher", "teach", "course")acl.deny("junior-student", "learn", "senior-course")5. Use It to Check Permissionif acl.is_allowed("student", "view", "course"): print("Students chould view courses.")else: print("Students chould not view courses.")if acl.is_allowed("junior-student", "learn", "senior-course"): print("Junior students chould learn senior courses.")else: print("Junior students chould not learn senior courses.")Product's homepage
simple-rbac Related Software