A library for authorization enforcement.
A library for authorization enforcement.
Helps you organize and enforce authorization so you can focus on the decision-making logic.
Terminal
pip install entitled
# with poetry
poetry install entitled
Key features
Model-agnostic
RBAC, ABAC, ACL... you choose the model, Entitled enforces it.
Easy organization
Policies and Rules neatly organize your decision logic.
Single decision point
A single entrypoint for your authorization decisions.
Basic usage
Define your resource and actors, on your terms.
#resources.py class User: id: int class Post: id: int owner: User
Create a policy for your resource.
# policies.py import entitled post_policy = entitled.Policy[Post]()
Rules encapsulate your logic.
# policies.py @post_policy.rule("edit") def can_edit_post(actor: User, resource: Post, context) -> bool: return resource.owner == actor
Enforce your policies.
client = entitled.Client() client.register(post_policy) if client.allows("edit", user, post): # your business logic