1
0
mirror of https://github.com/bitwarden/server synced 2026-01-19 08:53:57 +00:00

[Provider] Server entities and models (#1370)

* Mock out provider models and service

* Implement CreateAsync, CompleteSetupAsync, UpdateAsync, InviteUserAsync and ResendInvitesAsync

* Implement AcceptUserAsync and ConfirmUsersAsync

* Implement SaveUserAsync and DeleteUserAsync

* Add email templates

* Add admin operations for providers

* Fix mail template names

* Rename roles

* Verify provider has provideradmin

* Add self hosted check to admin controller

* Resolve review comments

* Update sql queries

* Change create provider to use email instead of userId
This commit is contained in:
Oscar Hinton
2021-06-03 18:58:29 +02:00
committed by GitHub
parent 58954f161e
commit fe1ffb6a22
58 changed files with 2110 additions and 6 deletions

View File

@@ -0,0 +1,42 @@
CREATE PROCEDURE [dbo].[ProviderUser_DeleteByIds]
@Ids [dbo].[GuidIdArray] READONLY
AS
BEGIN
SET NOCOUNT ON
EXEC [dbo].[User_BumpAccountRevisionDateByProviderUserIds] @Ids
DECLARE @UserAndProviderIds [dbo].[TwoGuidIdArray]
INSERT INTO @UserAndProviderIds
(Id1, Id2)
SELECT
UserId,
ProviderId
FROM
[dbo].[ProviderUser] PU
INNER JOIN
@Ids PUIds ON PUIds.Id = PU.Id
WHERE
UserId IS NOT NULL AND
ProviderId IS NOT NULL
DECLARE @BatchSize INT = 100
-- Delete ProviderUsers
WHILE @BatchSize > 0
BEGIN
BEGIN TRANSACTION ProviderUser_DeleteMany_PUs
DELETE TOP(@BatchSize) OU
FROM
[dbo].[ProviderUser] PU
INNER JOIN
@Ids I ON I.Id = PU.Id
SET @BatchSize = @@ROWCOUNT
COMMIT TRANSACTION ProviderUser_DeleteMany_PUs
END
END
GO