-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Allow for bulk updating AuthRequest
database objects
#4053
Merged
addisonbeck
merged 20 commits into
main
from
ac/addison/ac-2301/service-bulk-device-approval-endpoint-api
May 22, 2024
Merged
Allow for bulk updating AuthRequest
database objects
#4053
addisonbeck
merged 20 commits into
main
from
ac/addison/ac-2301/service-bulk-device-approval-endpoint-api
May 22, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addisonbeck
force-pushed
the
ac/addison/ac-2301/service-bulk-device-approval-endpoint-api
branch
from
May 3, 2024 22:08
bb61771
to
c6974aa
Compare
addisonbeck
force-pushed
the
ac/addison/ac-2301/service-bulk-device-approval-endpoint-api
branch
15 times, most recently
from
May 6, 2024 22:33
afe11b7
to
d16f587
Compare
To facilitate a new bulk device login request approval workflow in the admin console we need to update `IAuthRequestRepisitory` (owned by Auth team) to include an`UpdateManyAsync()` method. It should accept a list of `AuthRequest` table objects, and implementations will do a very simple 1:1 update of the passed in data. This commit adds an `UpdateManyAsync()` method to the `AuthRequestRepository` interface.
This commit stubs out implementations of `IAuthRequestRepository.UpdateManyAsync()` so the method signature can be called in unit tests. At this stage the methods are not implemented.
To facilitate a bulk update operation for auth requests a new user defined type will need to be written that can be used as a table input to the stored procedure. This will follow a similar pattern to how the `OragnizationSponsorshipType` works and is used by the stored procedure `OrganizationSponsorship_UpdateMany`.
To facilitate the bulk updating of auth request table objects this commit adds a new stored procedure to update a collection of entities on `AuthRequest` table by their primary key. It updates all properties, for convention, but the endpoint created later will only change the `Approved`, `ResponseDate`, `Key`, `MasterPasswordHash`, and `AuthenticationDate` properties.
This commit simply applies a migration script containing the new user defined type and stored procedure comitted previously.
The current pattern in place for bulk update stored procedures is to pass a `DataTable` through Dapper as an input for the update stored procedure being run. In order to facilitate the new bulk update procedure for the`AuthRequest` type we need a function added that can convert an `IEnumerable<AuthRequest>` to a `DataTable`. This is commit follows the convention of having a static class with a conversion method in a `Helpers` folder: `AuthRequestHelpers.ToDataTable()`.
This commit implements `AuthRequestRepository.UpdateMany()` for the Dapper implementation of `AuthRequestRepository`. It connects the stored procedure, `DataTable` converter, and Dapper-focused unit test commits written previously into one exposed method that can be referenced by service callers.
This commit implements the new `IAuthRequestRepository.UpdateManyAsync()`method in the Entity Framework skew of the repository layer. It checks to make sure the passed in list has auth requests, converts them all to an Entity Framework entity, and then uses `UpdateRange` to apply the whole thing over in the database context.
addisonbeck
force-pushed
the
ac/addison/ac-2301/service-bulk-device-approval-endpoint-api
branch
from
May 6, 2024 22:37
d16f587
to
9d5b27e
Compare
New Issues
Fixed Issues
|
addisonbeck
force-pushed
the
ac/addison/ac-2301/service-bulk-device-approval-endpoint-api
branch
5 times, most recently
from
May 13, 2024 19:20
5d2c926
to
fab5fde
Compare
addisonbeck
force-pushed
the
ac/addison/ac-2301/service-bulk-device-approval-endpoint-api
branch
from
May 13, 2024 19:22
fab5fde
to
cea0589
Compare
addisonbeck
force-pushed
the
ac/addison/ac-2301/service-bulk-device-approval-endpoint-api
branch
2 times, most recently
from
May 20, 2024 20:59
f68432e
to
f4d6438
Compare
addisonbeck
force-pushed
the
ac/addison/ac-2301/service-bulk-device-approval-endpoint-api
branch
from
May 20, 2024 21:05
f4d6438
to
632e3fa
Compare
test/Infrastructure.IntegrationTest/Auth/Repositories/AuthRequestRepositoryTests.cs
Show resolved
Hide resolved
test/Infrastructure.IntegrationTest/Auth/Repositories/AuthRequestRepositoryTests.cs
Outdated
Show resolved
Hide resolved
ike-kottlowski
approved these changes
May 22, 2024
rkac-bw
approved these changes
May 22, 2024
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
addisonbeck
deleted the
ac/addison/ac-2301/service-bulk-device-approval-endpoint-api
branch
May 22, 2024 16:55
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of change
Objective
To facilitate a new bulk device login request approval workflow in the admin
console we need to update
IAuthRequestRepisitory
to include anUpdateManyAsync()
method. It should accept a list ofAuthRequest
tableobjects, and implementations will do a very simple 1:1 update of the passed
in data.
This pull request implements this behavior in the repository and database
layers of the bitwarden server.
Code changes
See the commits tab
References
to the more general and high level functions written in this PR for the repository layer.