{"categories":[{"label":"Application Frameworks","url":"https://skillfed.io/packages/category/software-development-libraries-application-frameworks/3"}],"enrichment":{"capability":"rules provides object-level permission checking for Django applications using rule-based predicates instead of database queries, and can also be used as a standalone predicate framework in other contexts.","skillfed_tags":["django-permissions","authorization","predicate-logic"],"use_cases":["Enforce object-level permissions in Django views\u2014e.g., allow users to edit only their own posts or comments","Build custom authorization logic for REST APIs without storing per-object permissions in the database","Implement role-based or attribute-based access control using predicates that inspect user roles or object properties","Test authorization rules in unit tests by composing predicates without needing fixtures or test data","Protect Django admin actions\u2014e.g., allow deletion only if the user is the object's owner"],"what_it_does":"rules is a lightweight authorization framework that lets you define object-level permissions using predicates\u2014callable functions that return True or False based on user and object state. Instead of storing permissions in a database, you compose predicates using logical operators to build rule sets that determine what actions a user can perform on specific objects. It integrates seamlessly with Django views, templates, and the admin interface, but can also be used standalone in non-Django contexts.\n\nThe core idea is simple: predicates are any callable accepting zero to two arguments (typically user and object), and you combine them with operators to express complex authorization logic. You add rules to a rule set, then test them against a user and object to get a boolean result. This approach avoids database queries for permission checks and keeps authorization logic in code where it's easier to version control and reason about.","worth_installing":"Yes, if you need lightweight object-level permissions in Django and prefer logic-based rules over database-backed permissions. The package is stable (Production/Stable status), has no known vulnerabilities, and zero runtime dependencies. However, the aging maintenance status (last release 711 days ago) means you should verify compatibility with your target Django version and be prepared to maintain a fork if critical issues arise."},"id":"rules","links":{"html":"https://skillfed.io/packages/rules","md":"https://skillfed.io/packages/rules.md","pypi":"https://pypi.org/project/rules/"},"maintenance":{"status":"aging"},"meta":{"latest_release":"2024-09-02","license_spdx":null,"license_treatment":"permissive","name":"rules","python_support":"unspecified","summary":"Awesome Django authorization, without the database"},"popularity":{"monthly_downloads":563384,"position":5980,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"3.5"}
