8000 Registration mechanism for role-less models · Issue #365 · ansible/django-ansible-base · GitHub
[go: up one dir, main page]

Skip to content

Registration mechanism for role-less models #365

Open

Description

@AlanCoding

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0