mirror of
https://github.com/bitwarden/server.git
synced 2024-11-25 12:45:18 +01:00
AccountRevisionDate to track changes for a user account. Managed via triggers.
This commit is contained in:
parent
1b30a27990
commit
fd961dfdf6
@ -102,5 +102,6 @@
|
|||||||
<Build Include="dbo\Stored Procedures\Grant_ReadByKey.sql" />
|
<Build Include="dbo\Stored Procedures\Grant_ReadByKey.sql" />
|
||||||
<Build Include="dbo\Stored Procedures\Grant_ReadBySubjectId.sql" />
|
<Build Include="dbo\Stored Procedures\Grant_ReadBySubjectId.sql" />
|
||||||
<Build Include="dbo\Stored Procedures\Grant_Save.sql" />
|
<Build Include="dbo\Stored Procedures\Grant_Save.sql" />
|
||||||
|
<Build Include="dbo\Stored Procedures\User_ReadAccountRevisionDateById.sql" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -13,6 +13,7 @@
|
|||||||
@TwoFactorRecoveryCode NVARCHAR(32),
|
@TwoFactorRecoveryCode NVARCHAR(32),
|
||||||
@EquivalentDomains NVARCHAR(MAX),
|
@EquivalentDomains NVARCHAR(MAX),
|
||||||
@ExcludedGlobalEquivalentDomains NVARCHAR(MAX),
|
@ExcludedGlobalEquivalentDomains NVARCHAR(MAX),
|
||||||
|
@AccountRevisionDate DATETIME2(7),
|
||||||
@CreationDate DATETIME2(7),
|
@CreationDate DATETIME2(7),
|
||||||
@RevisionDate DATETIME2(7)
|
@RevisionDate DATETIME2(7)
|
||||||
AS
|
AS
|
||||||
@ -35,6 +36,7 @@ BEGIN
|
|||||||
[TwoFactorRecoveryCode],
|
[TwoFactorRecoveryCode],
|
||||||
[EquivalentDomains],
|
[EquivalentDomains],
|
||||||
[ExcludedGlobalEquivalentDomains],
|
[ExcludedGlobalEquivalentDomains],
|
||||||
|
[AccountRevisionDate],
|
||||||
[CreationDate],
|
[CreationDate],
|
||||||
[RevisionDate]
|
[RevisionDate]
|
||||||
)
|
)
|
||||||
@ -54,6 +56,7 @@ BEGIN
|
|||||||
@TwoFactorRecoveryCode,
|
@TwoFactorRecoveryCode,
|
||||||
@EquivalentDomains,
|
@EquivalentDomains,
|
||||||
@ExcludedGlobalEquivalentDomains,
|
@ExcludedGlobalEquivalentDomains,
|
||||||
|
@AccountRevisionDate,
|
||||||
@CreationDate,
|
@CreationDate,
|
||||||
@RevisionDate
|
@RevisionDate
|
||||||
)
|
)
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
CREATE PROCEDURE [dbo].[User_ReadAccountRevisionDateById]
|
||||||
|
@Id UNIQUEIDENTIFIER
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
SET NOCOUNT ON
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
[AccountRevisionDate]
|
||||||
|
FROM
|
||||||
|
[dbo].[User]
|
||||||
|
WHERE
|
||||||
|
[Id] = @Id
|
||||||
|
END
|
@ -13,6 +13,7 @@
|
|||||||
@TwoFactorRecoveryCode NVARCHAR(32),
|
@TwoFactorRecoveryCode NVARCHAR(32),
|
||||||
@EquivalentDomains NVARCHAR(MAX),
|
@EquivalentDomains NVARCHAR(MAX),
|
||||||
@ExcludedGlobalEquivalentDomains NVARCHAR(MAX),
|
@ExcludedGlobalEquivalentDomains NVARCHAR(MAX),
|
||||||
|
@AccountRevisionDate DATETIME2(7),
|
||||||
@CreationDate DATETIME2(7),
|
@CreationDate DATETIME2(7),
|
||||||
@RevisionDate DATETIME2(7)
|
@RevisionDate DATETIME2(7)
|
||||||
AS
|
AS
|
||||||
@ -35,6 +36,7 @@ BEGIN
|
|||||||
[TwoFactorRecoveryCode] = @TwoFactorRecoveryCode,
|
[TwoFactorRecoveryCode] = @TwoFactorRecoveryCode,
|
||||||
[EquivalentDomains] = @EquivalentDomains,
|
[EquivalentDomains] = @EquivalentDomains,
|
||||||
[ExcludedGlobalEquivalentDomains] = @ExcludedGlobalEquivalentDomains,
|
[ExcludedGlobalEquivalentDomains] = @ExcludedGlobalEquivalentDomains,
|
||||||
|
[AccountRevisionDate] = @AccountRevisionDate,
|
||||||
[CreationDate] = @CreationDate,
|
[CreationDate] = @CreationDate,
|
||||||
[RevisionDate] = @RevisionDate
|
[RevisionDate] = @RevisionDate
|
||||||
WHERE
|
WHERE
|
||||||
|
@ -42,6 +42,11 @@ BEGIN
|
|||||||
[CreationDate]
|
[CreationDate]
|
||||||
FROM
|
FROM
|
||||||
INSERTED
|
INSERTED
|
||||||
|
|
||||||
|
UPDATE
|
||||||
|
[User]
|
||||||
|
SET
|
||||||
|
[AccountRevisionDate] = GETUTCDATE()
|
||||||
END
|
END
|
||||||
GO
|
GO
|
||||||
CREATE TRIGGER [dbo].[Cipher_Updated]
|
CREATE TRIGGER [dbo].[Cipher_Updated]
|
||||||
@ -67,6 +72,11 @@ BEGIN
|
|||||||
[RevisionDate]
|
[RevisionDate]
|
||||||
FROM
|
FROM
|
||||||
INSERTED
|
INSERTED
|
||||||
|
|
||||||
|
UPDATE
|
||||||
|
[User]
|
||||||
|
SET
|
||||||
|
[AccountRevisionDate] = GETUTCDATE()
|
||||||
END
|
END
|
||||||
GO
|
GO
|
||||||
CREATE TRIGGER [dbo].[Cipher_Deleted]
|
CREATE TRIGGER [dbo].[Cipher_Deleted]
|
||||||
@ -92,4 +102,9 @@ BEGIN
|
|||||||
GETUTCDATE()
|
GETUTCDATE()
|
||||||
FROM
|
FROM
|
||||||
DELETED
|
DELETED
|
||||||
|
|
||||||
|
UPDATE
|
||||||
|
[User]
|
||||||
|
SET
|
||||||
|
[AccountRevisionDate] = GETUTCDATE()
|
||||||
END
|
END
|
@ -13,6 +13,7 @@
|
|||||||
[TwoFactorRecoveryCode] NVARCHAR (32) NULL,
|
[TwoFactorRecoveryCode] NVARCHAR (32) NULL,
|
||||||
[EquivalentDomains] NVARCHAR (MAX) NULL,
|
[EquivalentDomains] NVARCHAR (MAX) NULL,
|
||||||
[ExcludedGlobalEquivalentDomains] NVARCHAR (MAX) NULL,
|
[ExcludedGlobalEquivalentDomains] NVARCHAR (MAX) NULL,
|
||||||
|
[AccountRevisionDate] DATETIME2 (7) NOT NULL,
|
||||||
[CreationDate] DATETIME2 (7) NOT NULL,
|
[CreationDate] DATETIME2 (7) NOT NULL,
|
||||||
[RevisionDate] DATETIME2 (7) NOT NULL,
|
[RevisionDate] DATETIME2 (7) NOT NULL,
|
||||||
CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED ([Id] ASC)
|
CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED ([Id] ASC)
|
||||||
|
Loading…
Reference in New Issue
Block a user