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

Issue 48499: Use preferred SecurityPolicyManager.savePolicy() variant #375

Merged
merged 4 commits into from
Aug 29, 2023

Conversation

labkey-jeckels
Copy link
Contributor

Rationale

We're uneven in terms of the validation and auditing we do for saving SecurityPolicies and related updates, and want to be more consistent.

Related Pull Requests

Changes

  • Let modules register ContainerSecurableResourceProviders instead of having Container know about them all
  • Remove the savePolicy and createContainer methods that don't take a user, check permissions, or log for audit purposes
  • Introduce User.getAdminServiceUser() for sudo like scenarios or when we're doing an operation not initiated by a user, like bootstrapping the server
  • Update callers

@labkey-jeckels labkey-jeckels requested review from vagisha and a team August 28, 2023 03:45
…alTask, pass in the User that started the pipeline job instead of User.getAdminServiceUser(). This user will have admin permissions in all the Panorama Public project folders.
@@ -544,7 +544,7 @@ private void updatePermissions(User formSubmitter, ExperimentAnnotations targetE
assignPanoramaPublicSubmitterRole(newPolicy, log, targetExperiment.getSubmitterUser(), targetExperiment.getLabHeadUser(),
formSubmitter); // User that submitted the form. Can be different from the user selected as the data submitter

SecurityPolicyManager.savePolicy(newPolicy);
SecurityPolicyManager.savePolicy(newPolicy, pipelineJobUser);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be OK to pass in the User that started the pipeline job instead of User.getAdminServiceUser(). I will revert the changes in my commit if tests fail due to this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

{
MutableSecurityPolicy newPolicy = new MutableSecurityPolicy(target, target.getPolicy());
newPolicy.addRoleAssignment(reader, ReaderRole.class);
SecurityPolicyManager.savePolicy(newPolicy);
SecurityPolicyManager.savePolicy(newPolicy, pipelineJobUser);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. It should be OK to pass in the User that started the pipeline job instead of User.getAdminServiceUser().

@labkey-jeckels labkey-jeckels merged commit 1c0ed41 into develop Aug 29, 2023
4 checks passed
@labkey-jeckels labkey-jeckels deleted the fb_48499_savePolicyAudit branch August 29, 2023 17:28
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