-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[PM-16812] Shortcut duplicate group patch requests #5354
base: main
Are you sure you want to change the base?
[PM-16812] Shortcut duplicate group patch requests #5354
Conversation
…duplicate-group-patch-requests
…duplicate-group-patch-requests
LaunchDarkly flag references🔍 1 flag added or modified
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5354 +/- ##
==========================================
+ Coverage 44.30% 44.38% +0.08%
==========================================
Files 1497 1498 +1
Lines 69212 69360 +148
Branches 6241 6260 +19
==========================================
+ Hits 30665 30788 +123
- Misses 37224 37243 +19
- Partials 1323 1329 +6 ☔ View full report in Codecov by Sentry. |
New Issues (13)Checkmarx found the following issues in this Pull Request
Fixed Issues (16)Great job! The following issues were fixed in this Pull Request
|
…duplicate-group-patch-requests
private async Task AddMembersAsync(Group group, HashSet<Guid> usersToAdd) | ||
{ | ||
// Azure Entra ID is known to send redundant "add" requests for each existing member every time any member | ||
// is removed. To avoid excessive load on the database, we check against the high availability replica and | ||
// return early if they already exist. | ||
var groupMembers = await _groupRepository.GetManyUserIdsByIdAsync(group.Id, useReadOnlyReplica: true); | ||
if (usersToAdd.IsSubsetOf(groupMembers)) | ||
{ | ||
_logger.LogDebug("Ignoring duplicate SCIM request to add members {Members} to group {Group}", usersToAdd, group.Id); | ||
return; | ||
} | ||
|
||
await _groupRepository.AddGroupUsersByIdAsync(group.Id, usersToAdd); | ||
} |
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.
The interesting part of the new command.
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.
lgtm
Database tests are failing but for an unrelated sproc. Investigating it with the team. PR can still be reviewed in the meantime. |
…duplicate-group-patch-requests
Resolved conflicts - the only conflict was around the feature flag definitions in |
Quality Gate passedIssues Measures |
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-16812
📔 Objective
Solve 3 issues with our current SCIM PATCH group handling:
While I was here, I refactored the Group Patch command to use a flat switch statement (rather than the various nested if / else ifs), and extracted constants to a separate file. This is implemented (along with the main changes) as a vNext version of the command behind a feature flag.
Testing is covered by:
SubstituteService
method wasn't working properly otherwise.📸 Screenshots
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes