-
Notifications
You must be signed in to change notification settings - Fork 12
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
base: develop
Are you sure you want to change the base?
Conversation
Quality Gate passedIssues Measures |
@@ -1038,7 +1039,6 @@ from ${GroupMemberTable as groupMemberTable} | |||
} | |||
removeAllGroupMembers(groupId) | |||
insertGroupMembers(groupId, memberList) | |||
updateGroupUpdatedDateAndVersion(id) |
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 is an internal function, calling updateGroupUpdatedDateAndVersion
is redundant
_ <- directoryDAO.updateGroupUpdatedDateAndVersionWithSession( | ||
FullyQualifiedPolicyId(policyId.resource, policyId.accessPolicyName), | ||
samRequestContext | ||
) |
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.
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 |
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.
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.
validatableAccessPolicy.emailsToSubjects.values.flatten.toSet ++ validatableAccessPolicy.memberPolicies | ||
.getOrElse(Set.empty) | ||
.map(_.toFullyQualifiedPolicyId), |
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.
See comment below. memberPolicies
are no longer included in emailsToSubjects
so add them here when constructing the policy
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