-
-
Notifications
You must be signed in to change notification settings - Fork 25
[API] Make the GET /resources endpoint public #128
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
Comments
If you wanted to use this as an issue to walk someone through their first contribution, this should be close to a one-line change to the API code: https://www.django-rest-framework.org/api-guide/permissions/#isauthenticatedorreadonly from rest_framework import permissions
class ResourceView():
permission_classes = [permissions.IsAuthenticatedOrReadOnly]
#...
probably fits nicely into a 1 hour hangout. |
That's a GREAT idea!! I will raise it up in #codebuddies-meta. I could actually use some guidance on how to write a test for this, heh. We're primarily testing that the GET /resources endpoint works without passing in an auth token, right? |
…s/backend#128 is implemented and merged
Confirmed that Updated the acceptance criteria with some ideas for tests (h/t @BethanyG for suggesting in #codebuddies-meta): [ ] Change setup for tests to make sure we're not authed for the GET or search requests, but are authed for POST and PATCH |
Reading your next post plus slack, it looks like you've already figured it out tbh :) |
🤞🤞:) |
PR: #134 |
…s/backend#128 is implemented and merged
…s/backend#128 is implemented and merged
…s/backend#128 is implemented and merged
…s/backend#128 is implemented and merged
Context
Right now, on the front-end, we need to pass in a token (i.e. the user needs to be logged in) before they can see a list of resource.
This should be true for when users are creating a resource, but the list of resources on https://cb-react-concept.netlify.com/resources should be available to the public.
Acceptance Criteria
[ ] Make GET /resources not protected by authorization
[ ] Change setup for tests to make sure we're not authed for the GET requests, but are authed for POST, PATCH, and search.
[ ] Add test to make sure GET /api/v1/resources/{{guid}}/ and GET /api/v1/resources/ requests and search work without a token
[ ] Add/alter tests for GET GET /api/v1/resources/{{guid}}/ and GET /api/v1/resources/ requests and search to ensure that they also work with a token
[ ] Add tests to make sure PATCH and POST fail without a token
[ ] Add test to make sure DEL fails without a token
The text was updated successfully, but these errors were encountered: