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

SND Role Impersonation #207

Merged
merged 3 commits into from
Aug 6, 2024

Conversation

labkey-martyp
Copy link
Contributor

@labkey-martyp labkey-martyp commented Aug 1, 2024

Rationale

Override the new behavior of role impersonation to allow non-container based permissions checks.

Related Pull Requests

Changes

  • Use hasAllPermissions instead of hasPermission in SNDSecurityManager
  • Pass in roles to hasAllPermissions when doing Role Impersonation
  • Add better error handling in SND test

@labkey-adam
Copy link
Contributor

@labkey-martyp using an ImpersonationContext (directly or indirectly) does seem like the right approach. Would using LimitedUser or ElevatedUser meet your requirements? If so, this would be a more standard pattern.

@labkey-adam
Copy link
Contributor

Actually, my preferred option would be to call SecurityManager.hasAllPermissions() and pass in the roles as the contextualRoles parameter (empty in the non-impersonating case). Using contextual roles is usually the recommended way to do this sort of thing... no need for a new class, new user, etc.

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.

See comments... I think this can be simplified significantly. This is a job for contextual roles.

@labkey-martyp
Copy link
Contributor Author

See comments... I think this can be simplified significantly. This is a job for contextual roles.

Thanks @labkey-adam I'll check that out

@labkey-martyp
Copy link
Contributor Author

See comments... I think this can be simplified significantly. This is a job for contextual roles.

Thanks @labkey-adam I'll check that out

@labkey-adam Ok refactored to use hasAllPermissions. Please review when you're available.

@labkey-martyp labkey-martyp merged commit 67e94c6 into release24.7-SNAPSHOT Aug 6, 2024
2 checks passed
@labkey-martyp labkey-martyp deleted the 24.7_fb_snd_impersonate_role branch August 6, 2024 14:34
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.

2 participants