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

Add raise_exception arg to @group_required #10658

Closed
jacobtylerwalls opened this issue Mar 6, 2024 · 0 comments · Fixed by #10659
Closed

Add raise_exception arg to @group_required #10658

jacobtylerwalls opened this issue Mar 6, 2024 · 0 comments · Fixed by #10659

Comments

@jacobtylerwalls
Copy link
Member

The @group_required decorator for permission checking will, when the user fails the test, redirect to nowhere with status 302.

This is fine for requests to views that render templates. But for views that return JSON payloads, I'm suggesting that better than a 302 redirect is a 403 permission denied code.

We found in AfS that returning 3xx instead of 4xx error codes resulted in no error banner in knockout components.

Will open a PR to illustrate the idea.

@chiatt chiatt added this to pipeline Mar 6, 2024
jacobtylerwalls added a commit that referenced this issue Mar 6, 2024
Allows raising a 403 PermissionDenied for API-style
requests, instead of a 302 redirect to nowhere.
jacobtylerwalls added a commit that referenced this issue Mar 6, 2024
@jacobtylerwalls jacobtylerwalls moved this to 👀 In Review in pipeline Mar 9, 2024
jacobtylerwalls added a commit that referenced this issue Mar 14, 2024
@jacobtylerwalls jacobtylerwalls linked a pull request Mar 18, 2024 that will close this issue
6 tasks
apeters added a commit that referenced this issue Mar 19, 2024
Add raise_exception arg to @group_required #10658
@github-project-automation github-project-automation bot moved this from 👀 In Review to ✅ Done in pipeline Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant