mirror of
https://github.com/bitwarden/server.git
synced 2025-07-07 02:52:50 -05:00
Merge branch 'master' into feature/billing-obfuscation
This commit is contained in:
@ -238,6 +238,7 @@
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUser_Activate.sql" />
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUser_Create.sql" />
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUser_CreateMany.sql" />
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUser_CreateMany2.sql" />
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUser_CreateWithCollections.sql" />
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUser_Deactivate.sql" />
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUser_DeleteById.sql" />
|
||||
@ -258,6 +259,7 @@
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUser_SelectKnownEmails.sql" />
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUser_Update.sql" />
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUser_UpdateMany.sql" />
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUser_UpdateMany2.sql" />
|
||||
<Build Include="dbo\Stored Procedures\OrganizationUser_UpdateWithCollections.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Organization_Create.sql" />
|
||||
<Build Include="dbo\Stored Procedures\Organization_DeleteById.sql" />
|
||||
@ -400,6 +402,7 @@
|
||||
<Build Include="dbo\User Defined Types\GuidIdArray.sql" />
|
||||
<Build Include="dbo\User Defined Types\OrganizationSponsorshipType.sql" />
|
||||
<Build Include="dbo\User Defined Types\OrganizationUserType.sql" />
|
||||
<Build Include="dbo\User Defined Types\OrganizationUserType2.sql" />
|
||||
<Build Include="dbo\User Defined Types\SelectionReadOnlyArray.sql" />
|
||||
<Build Include="dbo\User Defined Types\TwoGuidIdArray.sql" />
|
||||
<Build Include="dbo\Views\AuthRequestView.sql" />
|
||||
|
@ -11,7 +11,8 @@
|
||||
@CreationDate DATETIME2(7),
|
||||
@RevisionDate DATETIME2(7),
|
||||
@Permissions NVARCHAR(MAX),
|
||||
@ResetPasswordKey VARCHAR(MAX)
|
||||
@ResetPasswordKey VARCHAR(MAX),
|
||||
@AccessSecretsManager BIT = 0
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
@ -30,7 +31,8 @@ BEGIN
|
||||
[CreationDate],
|
||||
[RevisionDate],
|
||||
[Permissions],
|
||||
[ResetPasswordKey]
|
||||
[ResetPasswordKey],
|
||||
[AccessSecretsManager]
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@ -46,6 +48,7 @@ BEGIN
|
||||
@CreationDate,
|
||||
@RevisionDate,
|
||||
@Permissions,
|
||||
@ResetPasswordKey
|
||||
@ResetPasswordKey,
|
||||
@AccessSecretsManager
|
||||
)
|
||||
END
|
||||
|
@ -0,0 +1,42 @@
|
||||
CREATE PROCEDURE [dbo].[OrganizationUser_CreateMany2]
|
||||
@OrganizationUsersInput [dbo].[OrganizationUserType2] READONLY
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
INSERT INTO [dbo].[OrganizationUser]
|
||||
(
|
||||
[Id],
|
||||
[OrganizationId],
|
||||
[UserId],
|
||||
[Email],
|
||||
[Key],
|
||||
[Status],
|
||||
[Type],
|
||||
[AccessAll],
|
||||
[ExternalId],
|
||||
[CreationDate],
|
||||
[RevisionDate],
|
||||
[Permissions],
|
||||
[ResetPasswordKey],
|
||||
[AccessSecretsManager]
|
||||
)
|
||||
SELECT
|
||||
OU.[Id],
|
||||
OU.[OrganizationId],
|
||||
OU.[UserId],
|
||||
OU.[Email],
|
||||
OU.[Key],
|
||||
OU.[Status],
|
||||
OU.[Type],
|
||||
OU.[AccessAll],
|
||||
OU.[ExternalId],
|
||||
OU.[CreationDate],
|
||||
OU.[RevisionDate],
|
||||
OU.[Permissions],
|
||||
OU.[ResetPasswordKey],
|
||||
OU.[AccessSecretsManager]
|
||||
FROM
|
||||
@OrganizationUsersInput OU
|
||||
END
|
||||
GO
|
@ -12,12 +12,13 @@
|
||||
@RevisionDate DATETIME2(7),
|
||||
@Permissions NVARCHAR(MAX),
|
||||
@ResetPasswordKey VARCHAR(MAX),
|
||||
@Collections AS [dbo].[SelectionReadOnlyArray] READONLY
|
||||
@Collections AS [dbo].[SelectionReadOnlyArray] READONLY,
|
||||
@AccessSecretsManager BIT = 0
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
EXEC [dbo].[OrganizationUser_Create] @Id, @OrganizationId, @UserId, @Email, @Key, @Status, @Type, @AccessAll, @ExternalId, @CreationDate, @RevisionDate, @Permissions, @ResetPasswordKey
|
||||
EXEC [dbo].[OrganizationUser_Create] @Id, @OrganizationId, @UserId, @Email, @Key, @Status, @Type, @AccessAll, @ExternalId, @CreationDate, @RevisionDate, @Permissions, @ResetPasswordKey, @AccessSecretsManager
|
||||
|
||||
;WITH [AvailableCollectionsCTE] AS(
|
||||
SELECT
|
||||
|
@ -11,7 +11,8 @@
|
||||
@CreationDate DATETIME2(7),
|
||||
@RevisionDate DATETIME2(7),
|
||||
@Permissions NVARCHAR(MAX),
|
||||
@ResetPasswordKey VARCHAR(MAX)
|
||||
@ResetPasswordKey VARCHAR(MAX),
|
||||
@AccessSecretsManager BIT = 0
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
@ -30,7 +31,8 @@ BEGIN
|
||||
[CreationDate] = @CreationDate,
|
||||
[RevisionDate] = @RevisionDate,
|
||||
[Permissions] = @Permissions,
|
||||
[ResetPasswordKey] = @ResetPasswordKey
|
||||
[ResetPasswordKey] = @ResetPasswordKey,
|
||||
[AccessSecretsManager] = @AccessSecretsManager
|
||||
WHERE
|
||||
[Id] = @Id
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
CREATE PROCEDURE [dbo].[OrganizationUser_UpdateMany2]
|
||||
@OrganizationUsersInput [dbo].[OrganizationUserType2] READONLY
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
UPDATE
|
||||
OU
|
||||
SET
|
||||
[OrganizationId] = OUI.[OrganizationId],
|
||||
[UserId] = OUI.[UserId],
|
||||
[Email] = OUI.[Email],
|
||||
[Key] = OUI.[Key],
|
||||
[Status] = OUI.[Status],
|
||||
[Type] = OUI.[Type],
|
||||
[AccessAll] = OUI.[AccessAll],
|
||||
[ExternalId] = OUI.[ExternalId],
|
||||
[CreationDate] = OUI.[CreationDate],
|
||||
[RevisionDate] = OUI.[RevisionDate],
|
||||
[Permissions] = OUI.[Permissions],
|
||||
[ResetPasswordKey] = OUI.[ResetPasswordKey],
|
||||
[AccessSecretsManager] = OUI.[AccessSecretsManager]
|
||||
FROM
|
||||
[dbo].[OrganizationUser] OU
|
||||
INNER JOIN
|
||||
@OrganizationUsersInput OUI ON OU.Id = OUI.Id
|
||||
|
||||
EXEC [dbo].[User_BumpManyAccountRevisionDates]
|
||||
(
|
||||
SELECT UserId
|
||||
FROM @OrganizationUsersInput
|
||||
)
|
||||
END
|
||||
GO
|
@ -12,12 +12,13 @@
|
||||
@RevisionDate DATETIME2(7),
|
||||
@Permissions NVARCHAR(MAX),
|
||||
@ResetPasswordKey VARCHAR(MAX),
|
||||
@Collections AS [dbo].[SelectionReadOnlyArray] READONLY
|
||||
@Collections AS [dbo].[SelectionReadOnlyArray] READONLY,
|
||||
@AccessSecretsManager BIT = 0
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
|
||||
EXEC [dbo].[OrganizationUser_Update] @Id, @OrganizationId, @UserId, @Email, @Key, @Status, @Type, @AccessAll, @ExternalId, @CreationDate, @RevisionDate, @Permissions, @ResetPasswordKey
|
||||
EXEC [dbo].[OrganizationUser_Update] @Id, @OrganizationId, @UserId, @Email, @Key, @Status, @Type, @AccessAll, @ExternalId, @CreationDate, @RevisionDate, @Permissions, @ResetPasswordKey, @AccessSecretsManager
|
||||
-- Update
|
||||
UPDATE
|
||||
[Target]
|
||||
|
@ -1,5 +1,6 @@
|
||||
CREATE PROCEDURE [dbo].[ProviderUserUserDetails_ReadByProviderId]
|
||||
@ProviderId UNIQUEIDENTIFIER
|
||||
@ProviderId UNIQUEIDENTIFIER,
|
||||
@Status TINYINT = NULL
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
@ -10,4 +11,5 @@ BEGIN
|
||||
[dbo].[ProviderUserUserDetailsView]
|
||||
WHERE
|
||||
[ProviderId] = @ProviderId
|
||||
AND [Status] = COALESCE(@Status, [Status])
|
||||
END
|
||||
|
@ -37,7 +37,11 @@
|
||||
@FailedLoginCount INT = 0,
|
||||
@LastFailedLoginDate DATETIME2(7),
|
||||
@UnknownDeviceVerificationEnabled BIT = 1,
|
||||
@AvatarColor VARCHAR(7) = NULL
|
||||
@AvatarColor VARCHAR(7) = NULL,
|
||||
@LastPasswordChangeDate DATETIME2(7) = NULL,
|
||||
@LastKdfChangeDate DATETIME2(7) = NULL,
|
||||
@LastKeyRotationDate DATETIME2(7) = NULL,
|
||||
@LastEmailChangeDate DATETIME2(7) = NULL
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
@ -82,7 +86,11 @@ BEGIN
|
||||
[UnknownDeviceVerificationEnabled],
|
||||
[AvatarColor],
|
||||
[KdfMemory],
|
||||
[KdfParallelism]
|
||||
[KdfParallelism],
|
||||
[LastPasswordChangeDate],
|
||||
[LastKdfChangeDate],
|
||||
[LastKeyRotationDate],
|
||||
[LastEmailChangeDate]
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@ -124,6 +132,10 @@ BEGIN
|
||||
@UnknownDeviceVerificationEnabled,
|
||||
@AvatarColor,
|
||||
@KdfMemory,
|
||||
@KdfParallelism
|
||||
@KdfParallelism,
|
||||
@LastPasswordChangeDate,
|
||||
@LastKdfChangeDate,
|
||||
@LastKeyRotationDate,
|
||||
@LastEmailChangeDate
|
||||
)
|
||||
END
|
||||
|
@ -37,7 +37,11 @@
|
||||
@FailedLoginCount INT,
|
||||
@LastFailedLoginDate DATETIME2(7),
|
||||
@UnknownDeviceVerificationEnabled BIT = 1,
|
||||
@AvatarColor VARCHAR(7)
|
||||
@AvatarColor VARCHAR(7),
|
||||
@LastPasswordChangeDate DATETIME2(7) = NULL,
|
||||
@LastKdfChangeDate DATETIME2(7) = NULL,
|
||||
@LastKeyRotationDate DATETIME2(7) = NULL,
|
||||
@LastEmailChangeDate DATETIME2(7) = NULL
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
@ -82,7 +86,11 @@ BEGIN
|
||||
[FailedLoginCount] = @FailedLoginCount,
|
||||
[LastFailedLoginDate] = @LastFailedLoginDate,
|
||||
[UnknownDeviceVerificationEnabled] = @UnknownDeviceVerificationEnabled,
|
||||
[AvatarColor] = @AvatarColor
|
||||
[AvatarColor] = @AvatarColor,
|
||||
[LastPasswordChangeDate] = @LastPasswordChangeDate,
|
||||
[LastKdfChangeDate] = @LastKdfChangeDate,
|
||||
[LastKeyRotationDate] = @LastKeyRotationDate,
|
||||
[LastEmailChangeDate] = @LastEmailChangeDate
|
||||
WHERE
|
||||
[Id] = @Id
|
||||
END
|
||||
|
@ -3,7 +3,9 @@
|
||||
@SecurityStamp NVARCHAR(50),
|
||||
@Key NVARCHAR(MAX),
|
||||
@PrivateKey VARCHAR(MAX),
|
||||
@RevisionDate DATETIME2(7)
|
||||
@RevisionDate DATETIME2(7),
|
||||
@AccountRevisionDate DATETIME2(7) = NULL,
|
||||
@LastKeyRotationDate DATETIME2(7) = NULL
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
@ -15,7 +17,8 @@ BEGIN
|
||||
[Key] = @Key,
|
||||
[PrivateKey] = @PrivateKey,
|
||||
[RevisionDate] = @RevisionDate,
|
||||
[AccountRevisionDate] = @RevisionDate
|
||||
[AccountRevisionDate] = ISNULL(@AccountRevisionDate, @RevisionDate),
|
||||
[LastKeyRotationDate] = @LastKeyRotationDate
|
||||
WHERE
|
||||
[Id] = @Id
|
||||
END
|
@ -12,6 +12,7 @@
|
||||
[CreationDate] DATETIME2 (7) NOT NULL,
|
||||
[RevisionDate] DATETIME2 (7) NOT NULL,
|
||||
[Permissions] NVARCHAR (MAX) NULL,
|
||||
[AccessSecretsManager] BIT NOT NULL CONSTRAINT [DF_OrganizationUser_SecretsManager] DEFAULT (0),
|
||||
CONSTRAINT [PK_OrganizationUser] PRIMARY KEY CLUSTERED ([Id] ASC),
|
||||
CONSTRAINT [FK_OrganizationUser_Organization] FOREIGN KEY ([OrganizationId]) REFERENCES [dbo].[Organization] ([Id]) ON DELETE CASCADE,
|
||||
CONSTRAINT [FK_OrganizationUser_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([Id])
|
||||
|
@ -37,7 +37,11 @@
|
||||
[FailedLoginCount] INT CONSTRAINT [D_User_FailedLoginCount] DEFAULT ((0)) NOT NULL,
|
||||
[LastFailedLoginDate] DATETIME2 (7) NULL,
|
||||
[UnknownDeviceVerificationEnabled] BIT CONSTRAINT [D_User_UnknownDeviceVerificationEnabled] DEFAULT ((1)) NOT NULL,
|
||||
[AvatarColor] VARCHAR(7) NULL,
|
||||
[AvatarColor] VARCHAR (7) NULL,
|
||||
[LastPasswordChangeDate] DATETIME2 (7) NULL,
|
||||
[LastKdfChangeDate] DATETIME2 (7) NULL,
|
||||
[LastKeyRotationDate] DATETIME2 (7) NULL,
|
||||
[LastEmailChangeDate] DATETIME2 (7) NULL,
|
||||
CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED ([Id] ASC)
|
||||
);
|
||||
|
||||
|
16
src/Sql/dbo/User Defined Types/OrganizationUserType2.sql
Normal file
16
src/Sql/dbo/User Defined Types/OrganizationUserType2.sql
Normal file
@ -0,0 +1,16 @@
|
||||
CREATE TYPE [dbo].[OrganizationUserType2] AS TABLE(
|
||||
[Id] UNIQUEIDENTIFIER,
|
||||
[OrganizationId] UNIQUEIDENTIFIER,
|
||||
[UserId] UNIQUEIDENTIFIER,
|
||||
[Email] NVARCHAR(256),
|
||||
[Key] VARCHAR(MAX),
|
||||
[Status] SMALLINT,
|
||||
[Type] TINYINT,
|
||||
[AccessAll] BIT,
|
||||
[ExternalId] NVARCHAR(300),
|
||||
[CreationDate] DATETIME2(7),
|
||||
[RevisionDate] DATETIME2(7),
|
||||
[Permissions] NVARCHAR(MAX),
|
||||
[ResetPasswordKey] VARCHAR(MAX),
|
||||
[AccessSecretsManager] BIT
|
||||
)
|
@ -39,7 +39,8 @@ SELECT
|
||||
OS.[FriendlyName] FamilySponsorshipFriendlyName,
|
||||
OS.[LastSyncDate] FamilySponsorshipLastSyncDate,
|
||||
OS.[ToDelete] FamilySponsorshipToDelete,
|
||||
OS.[ValidUntil] FamilySponsorshipValidUntil
|
||||
OS.[ValidUntil] FamilySponsorshipValidUntil,
|
||||
OU.[AccessSecretsManager]
|
||||
FROM
|
||||
[dbo].[OrganizationUser] OU
|
||||
LEFT JOIN
|
||||
|
@ -11,6 +11,7 @@ SELECT
|
||||
OU.[Status],
|
||||
OU.[Type],
|
||||
OU.[AccessAll],
|
||||
OU.[AccessSecretsManager],
|
||||
OU.[ExternalId],
|
||||
SU.[ExternalId] SsoExternalId,
|
||||
OU.[Permissions],
|
||||
|
@ -30,7 +30,8 @@ SELECT
|
||||
PU.[Type],
|
||||
PO.[ProviderId],
|
||||
PU.[Id] ProviderUserId,
|
||||
P.[Name] ProviderName
|
||||
P.[Name] ProviderName,
|
||||
O.[PlanType]
|
||||
FROM
|
||||
[dbo].[ProviderUser] PU
|
||||
INNER JOIN
|
||||
|
@ -0,0 +1,2 @@
|
||||
-- Created 2023-01
|
||||
-- DELETE FILE
|
@ -0,0 +1,2 @@
|
||||
-- Created 2023-01
|
||||
-- DELETE FILE
|
@ -0,0 +1,2 @@
|
||||
-- Created 2023-01
|
||||
-- DELETE FILE
|
Reference in New Issue
Block a user