Skip to content

Conversation

@labkey-nicka
Copy link
Contributor

Rationale

This addresses #720 by adding additional DEBUG logging.

Changes

  • Additional permission check logging

@labkey-nicka labkey-nicka self-assigned this Dec 15, 2025
Copy link
Contributor

@labkey-adam labkey-adam left a 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();

Copy link
Contributor

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?

Copy link
Contributor Author

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.";
Copy link
Contributor

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...

@labkey-adam
Copy link
Contributor

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.

@labkey-nicka labkey-nicka merged commit e1da7bd into release25.11-SNAPSHOT Dec 16, 2025
10 checks passed
@labkey-nicka labkey-nicka deleted the 25.11_fb_logging_720 branch December 16, 2025 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants