-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
fix: avoid calling undefined method for anonymous users #15440
Conversation
else: | ||
can_access, messages = request.user.can_access_with_errors(self.model, 'add', request.data) | ||
if not can_access: | ||
self.permission_denied(request, message=messages) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error occurs for me on GET, maybe on POST as well but my recreator is GET
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kdelee The request from the browser is a GET
, but when I debug it, there is always a second POST
request and that's the one that actually causes the error. I'm not quite sure where that's coming from, maybe @chrismeyersfsu knows?
This might be a bit cleaner. I think this is the parent Line 101 in 43a3d4a
Seems like it would be safe to call the parent check_permissions() first. I tried the below code manually and it seems to work (by work I mean deny anonymous user and allow logged in user to create a job template)
|
@chrismeyersfsu you're correct, just calling |
|
SUMMARY
The method
can_access_with_errors
is not defined onAnonymousUser
and this raises an exception when accessing the job_templates or workflow_job_templates APIs.ISSUE TYPE
COMPONENT NAME
AWX VERSION
ADDITIONAL INFORMATION