distributeaid / toolbox

DistributeAid Toolbox
http://distributeaid.org
GNU Affero General Public License v3.0
3 stars 1 forks source link

Authorisation GraphQL middleware #100

Closed pedro-gutierrez closed 3 years ago

pedro-gutierrez commented 3 years ago

Is your feature request related to a problem? Please describe.

At the moment we have the RequireUser graphql middleware that checks for a user in the current request scope and returns 403 in case no user was found.

Describe the solution you'd like

We need similar new middleware for the following general situations:

Module Use case
RequireAnonymous for operations that are only meant for anonymous access (eg, signup)
RequireGroupMember for operations that require that the user is a member of the current group
RequireGroupAdmin for operations that require a user that is an admin in the current group
RequireDaAdmin for operations that are only allowed for distribute aid admins

These middlewares can then be composed together into more complex middlewares for more specific use cases.