Skip to content

Support async logical combinations for permissions#85

Open
CristopherH95 wants to merge 4 commits intoem1208:mainfrom
CristopherH95:enhancement/support-perm-logic-ops
Open

Support async logical combinations for permissions#85
CristopherH95 wants to merge 4 commits intoem1208:mainfrom
CristopherH95:enhancement/support-perm-logic-ops

Conversation

@CristopherH95
Copy link
Copy Markdown
Contributor

This PR is my proposed solution to #82. The following changes are introduced:

  • A permissions.py module that provides an AsyncBasePermission, for simplifying logical combinations of async permissions.
  • Async implementations for the AND, OR, and NOT logic operators from Django Rest Framework.
  • A try_convert_operator function, which is hooked into the get_permissions view method, for the purpose of normalizing combinations of sync and async logic operators.
  • Unit tests for the proposed implementation.

I tried to come up with an approach that is more or less a "drop in solution", to avoid breaking things. My intention was for this to work with existing permissions classes, as well as custom ones.

Resolves #82.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Combining permissions using logical operators breaks async permissions checks

1 participant