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

implement django-guardian for DRF API responses #379

Open
hburgund opened this issue Mar 5, 2019 · 0 comments
Open

implement django-guardian for DRF API responses #379

hburgund opened this issue Mar 5, 2019 · 0 comments

Comments

@hburgund
Copy link
Member

hburgund commented Mar 5, 2019

Currently, django-guardian is implemented for the built-in Django admin. Since Roundware is project-based, we only have object-level permissions applied to the project model and those essentially pass through to all other models via the project_id foreign key.

This works nicely, but we now need Guardian's object-level permissions to apply to the API responses generated by Django REST Framework (DRF) (api/2/) for a new admin system. We need to be able to assign object-level permissions to users on the project model and have those filter the returned results by project.

There is a Django app django-rest-framework-guardian that is supposed to extend Guardian functionality to DRF: https://github.com/rpkilby/django-rest-framework-guardian

Roundware APIV2 docs: https://roundware.org/api/

roundware-admin is the new admin system we are developing (for reference to the use-case): https://github.com/roundware/roundware-admin/

Other Useful Documentation

http://www.django-rest-framework.org/api-guide/permissions/#djangoobjectpermissions
http://www.django-rest-framework.org/api-guide/filtering/#filtering-against-the-current-user
http://www.django-rest-framework.org/api-guide/filtering/#djangoobjectpermissionsfilter
http://www.django-rest-framework.org/tutorial/4-authentication-and-permissions/#associating-snippets-with-users

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

No branches or pull requests

1 participant