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

[Question] Thoughts on where/how permissions are enforced? #28

Open
kbyatnal opened this issue Jul 21, 2020 · 2 comments
Open

[Question] Thoughts on where/how permissions are enforced? #28

kbyatnal opened this issue Jul 21, 2020 · 2 comments

Comments

@kbyatnal
Copy link

IMO ideally, each domain should enforce its own permissions. This would require passing along some sort of context with every call, and then services enforce permissions based on the requested data and context.

Curious to hear what others are doing as well.

@phalt
Copy link
Owner

phalt commented Jul 21, 2020

Great question. I was having a think about this the other day. Django has a robust permissions / groups / users system and we should take advantage of that. Most API requests into a service should have a user associated to them, so I would imagine you'd want to tap into the user permissions system at the API layer, basically redoing what DRF does (which has a great permissions system IMO). As for service to service perms - you could decorate APIs and require a "request" or, like you say, a "context" object to be passed into methods.

@kbyatnal kbyatnal changed the title [Question] Thoughts on where/how are permissions enforced? [Question] Thoughts on where/how permissions are enforced? Jul 21, 2020
@c-py
Copy link

c-py commented Jul 27, 2020

I found a good example of putting authentication in business logic in the graphene-django issues here. I also found that when I implemented this, django-rules was quite useful for extending the built in django permission model. I did however need to pass in the user object to use this.

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

No branches or pull requests

3 participants