Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registration mechanism for role-less models #365

Open
AlanCoding opened this issue May 2, 2024 · 0 comments
Open

Registration mechanism for role-less models #365

AlanCoding opened this issue May 2, 2024 · 0 comments
Labels
app:rbac enhancement New feature or request

Comments

@AlanCoding
Copy link
Member

If you have a model you want to use roles for, you do permission_registry.register(MyModel).

However, some models you don't want roles for. A good example is Host from AWX. The model would, nonetheless, follow the general standards of "parent" resources in DAB RBAC. The parent of a Host object is its Inventory object. Any and all questions about access control for a host are deferred to its inventory. AWX covers this in various access logic.

This asks for a way to register a model, in that DAB RBAC will manage access control for it via its parent object, but will not track roles. Enforcing the rules will be done through API logic and utility methods (like the permission class and querysets), and no content will be put in the RoleEvaluation table for such models. This will offer much better performance than registering it as an ordinary model, because rebuilding entries in RoleEvaluation is unnecessary.

Total spitball:

permission_registry.lazy_register(Host)
@AlanCoding AlanCoding added enhancement New feature or request app:rbac labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app:rbac enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant