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

CORE-242 bulk membership update #1613

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft

Conversation

dvoet
Copy link
Collaborator

@dvoet dvoet commented Dec 20, 2024

Ticket: https://broadworkbench.atlassian.net/browse/CORE-242

<Don't forget to include the ticket number in the PR title!>

What:

<For your reviewers' sake, please describe in a sentence or two what this PR is accomplishing (usually from the users' perspective, but not necessarily).>

Why:

<For your reviewers' sake, please describe in ~1 paragraph what the value of this PR is to our users or to ourselves.>

How:

<For your reviewers' sake, please describe in ~1 paragraph how this PR accomplishes its goal.>

<If the PR is big, please indicate where a reviewer should start reading it (i.e. which file or function).>


PR checklist

  • I've followed the instructions if I've made any changes to the API, especially if they're breaking changes
  • I've filled out the Security Risk Assessment (requires Broad Internal network access) and attached the result to the JIRA ticket

@@ -1038,7 +1039,6 @@ from ${GroupMemberTable as groupMemberTable}
}
removeAllGroupMembers(groupId)
insertGroupMembers(groupId, memberList)
updateGroupUpdatedDateAndVersion(id)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is an internal function, calling updateGroupUpdatedDateAndVersion is redundant

Comment on lines -781 to -784
_ <- directoryDAO.updateGroupUpdatedDateAndVersionWithSession(
FullyQualifiedPolicyId(policyId.resource, policyId.accessPolicyName),
samRequestContext
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this was here as a failsafe but was double doing work. I made sure it is correctly called in the DAO. Maybe a follow on would be to figure out a trigger even though I despise triggers.

@@ -851,51 +906,14 @@ class ResourceService(
): IO[Set[ValidatableAccessPolicy]] =
policies.toList
.traverse { case (accessPolicyName, accessPolicyMembershipRequest) =>
for {
// grouping member emails and policy emails together
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It looks like this code was getting the email address for each policy and adding them to memberEmails of the policy. The problem is that policies that do not exist are just ignored. There is also no reason to load a policy by its identifiers, get its email, then use the email to load its identifiers. I changes all this to validate policies (so I could use that for the new api) then use the policy identifiers directly.

Comment on lines +258 to +260
validatableAccessPolicy.emailsToSubjects.values.flatten.toSet ++ validatableAccessPolicy.memberPolicies
.getOrElse(Set.empty)
.map(_.toFullyQualifiedPolicyId),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See comment below. memberPolicies are no longer included in emailsToSubjects so add them here when constructing the policy

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.

1 participant