-
Notifications
You must be signed in to change notification settings - Fork 7
Additional action logging #7270
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
Conversation
labkey-adam
left a comment
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.
This looks good, other than my comment about logging the user info.
As we discussed in standup, this approach will ensure minimal logging but highlight failures. In the future, I could see adding trace logging for the cases that pass, so one can see the entire permission checking process, if trace is available. Plus details about what permission(s) was/were missing, etc.
| Container c = context.getContainer(); | ||
| User user = context.getUser(); | ||
| Class<? extends Controller> actionClass = getClass(); | ||
|
|
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.
Shouldn't we unconditionally log the user and (if impersonated) the impersonating user? I know that'll increase the logs, but how else will Alex zero in on the users that are causing problems?
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.
Done
| if (shouldThrow) | ||
| throw new ForbiddenProjectException("You are not allowed to access this folder while impersonating within a different project."); | ||
| { | ||
| String msg = "You are not allowed to access this folder while impersonating within a different project."; |
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.
This causes no harm, but I think I improved what we return to API callers to include "forbidden project" exception messages. Of course, one has to look at those messages...
|
I did some manual testing on this with no problems. Agree that the user logging makes this a bit verbose. I lean toward merging this and adjusting as we learn more from clients. Potential future refactor: add user and detailed message to UnauthorizedException. Catch UnauthorizedException in caller and log.debug() there. |
Rationale
This addresses #720 by adding additional DEBUG logging.
Changes