From b3e4fcca74e07b03b7c0379e248e8b9f88ab22a7 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 15 May 2017 23:03:32 -0400 Subject: [PATCH] add externalid to organizationuser --- src/Core/Models/Table/OrganizationUser.cs | 1 + src/Sql/dbo/Stored Procedures/OrganizationUser_Create.sql | 3 +++ .../OrganizationUser_CreateWithCollections.sql | 3 ++- src/Sql/dbo/Stored Procedures/OrganizationUser_Update.sql | 2 ++ .../OrganizationUser_UpdateWithCollections.sql | 3 ++- src/Sql/dbo/Tables/OrganizationUser.sql | 1 + src/Sql/dbo/Views/OrganizationUserUserDetailsView.sql | 3 ++- 7 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Core/Models/Table/OrganizationUser.cs b/src/Core/Models/Table/OrganizationUser.cs index f30b6c195c..34f3ca0710 100644 --- a/src/Core/Models/Table/OrganizationUser.cs +++ b/src/Core/Models/Table/OrganizationUser.cs @@ -14,6 +14,7 @@ namespace Bit.Core.Models.Table public OrganizationUserStatusType Status { get; set; } public OrganizationUserType Type { get; set; } public bool AccessAll { get; set; } + public string ExternalId { get; set; } public DateTime CreationDate { get; internal set; } = DateTime.UtcNow; public DateTime RevisionDate { get; internal set; } = DateTime.UtcNow; diff --git a/src/Sql/dbo/Stored Procedures/OrganizationUser_Create.sql b/src/Sql/dbo/Stored Procedures/OrganizationUser_Create.sql index 5ca638028a..1ca7f95755 100644 --- a/src/Sql/dbo/Stored Procedures/OrganizationUser_Create.sql +++ b/src/Sql/dbo/Stored Procedures/OrganizationUser_Create.sql @@ -7,6 +7,7 @@ @Status TINYINT, @Type TINYINT, @AccessAll BIT, + @ExternalId NVARCHAR(300), @CreationDate DATETIME2(7), @RevisionDate DATETIME2(7) AS @@ -23,6 +24,7 @@ BEGIN [Status], [Type], [AccessAll], + [ExternalId], [CreationDate], [RevisionDate] ) @@ -36,6 +38,7 @@ BEGIN @Status, @Type, @AccessAll, + @ExternalId, @CreationDate, @RevisionDate ) diff --git a/src/Sql/dbo/Stored Procedures/OrganizationUser_CreateWithCollections.sql b/src/Sql/dbo/Stored Procedures/OrganizationUser_CreateWithCollections.sql index 6f32394d4a..1c7c88c757 100644 --- a/src/Sql/dbo/Stored Procedures/OrganizationUser_CreateWithCollections.sql +++ b/src/Sql/dbo/Stored Procedures/OrganizationUser_CreateWithCollections.sql @@ -7,6 +7,7 @@ @Status TINYINT, @Type TINYINT, @AccessAll BIT, + @ExternalId NVARCHAR(300), @CreationDate DATETIME2(7), @RevisionDate DATETIME2(7), @Collections AS [dbo].[SelectionReadOnlyArray] READONLY @@ -14,7 +15,7 @@ AS BEGIN SET NOCOUNT ON - EXEC [dbo].[OrganizationUser_Create] @Id, @OrganizationId, @UserId, @Email, @Key, @Status, @Type, @AccessAll, @CreationDate, @RevisionDate + EXEC [dbo].[OrganizationUser_Create] @Id, @OrganizationId, @UserId, @Email, @Key, @Status, @Type, @AccessAll, @ExternalId, @CreationDate, @RevisionDate ;WITH [AvailableCollectionsCTE] AS( SELECT diff --git a/src/Sql/dbo/Stored Procedures/OrganizationUser_Update.sql b/src/Sql/dbo/Stored Procedures/OrganizationUser_Update.sql index 7cf8f70bff..d945a95c0f 100644 --- a/src/Sql/dbo/Stored Procedures/OrganizationUser_Update.sql +++ b/src/Sql/dbo/Stored Procedures/OrganizationUser_Update.sql @@ -7,6 +7,7 @@ @Status TINYINT, @Type TINYINT, @AccessAll BIT, + @ExternalId NVARCHAR(300), @CreationDate DATETIME2(7), @RevisionDate DATETIME2(7) AS @@ -23,6 +24,7 @@ BEGIN [Status] = @Status, [Type] = @Type, [AccessAll] = @AccessAll, + [ExternalId] = @ExternalId, [CreationDate] = @CreationDate, [RevisionDate] = @RevisionDate WHERE diff --git a/src/Sql/dbo/Stored Procedures/OrganizationUser_UpdateWithCollections.sql b/src/Sql/dbo/Stored Procedures/OrganizationUser_UpdateWithCollections.sql index 54a9bdba9d..b35d688775 100644 --- a/src/Sql/dbo/Stored Procedures/OrganizationUser_UpdateWithCollections.sql +++ b/src/Sql/dbo/Stored Procedures/OrganizationUser_UpdateWithCollections.sql @@ -7,6 +7,7 @@ @Status TINYINT, @Type TINYINT, @AccessAll BIT, + @ExternalId NVARCHAR(300), @CreationDate DATETIME2(7), @RevisionDate DATETIME2(7), @Collections AS [dbo].[SelectionReadOnlyArray] READONLY @@ -14,7 +15,7 @@ AS BEGIN SET NOCOUNT ON - EXEC [dbo].[OrganizationUser_Update] @Id, @OrganizationId, @UserId, @Email, @Key, @Status, @Type, @AccessAll, @CreationDate, @RevisionDate + EXEC [dbo].[OrganizationUser_Update] @Id, @OrganizationId, @UserId, @Email, @Key, @Status, @Type, @AccessAll, @ExternalId, @CreationDate, @RevisionDate ;WITH [AvailableCollectionsCTE] AS( SELECT diff --git a/src/Sql/dbo/Tables/OrganizationUser.sql b/src/Sql/dbo/Tables/OrganizationUser.sql index 425de68b24..2b2b1880d9 100644 --- a/src/Sql/dbo/Tables/OrganizationUser.sql +++ b/src/Sql/dbo/Tables/OrganizationUser.sql @@ -7,6 +7,7 @@ [Status] TINYINT NOT NULL, [Type] TINYINT NOT NULL, [AccessAll] BIT NOT NULL, + [ExternalId] NVARCHAR (300) NULL, [CreationDate] DATETIME2 (7) NOT NULL, [RevisionDate] DATETIME2 (7) NOT NULL, CONSTRAINT [PK_OrganizationUser] PRIMARY KEY CLUSTERED ([Id] ASC), diff --git a/src/Sql/dbo/Views/OrganizationUserUserDetailsView.sql b/src/Sql/dbo/Views/OrganizationUserUserDetailsView.sql index 0bea008006..c8df6b6661 100644 --- a/src/Sql/dbo/Views/OrganizationUserUserDetailsView.sql +++ b/src/Sql/dbo/Views/OrganizationUserUserDetailsView.sql @@ -8,7 +8,8 @@ SELECT ISNULL(U.[Email], OU.[Email]) Email, OU.[Status], OU.[Type], - OU.[AccessAll] + OU.[AccessAll], + OU.[ExternalId] FROM [dbo].[OrganizationUser] OU LEFT JOIN