1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-03 00:52:49 -05:00

organization signup apis and data model changes

This commit is contained in:
Kyle Spearrin
2017-03-03 00:07:11 -05:00
parent b18b6a44ef
commit 29e3605576
20 changed files with 371 additions and 131 deletions

View File

@ -81,6 +81,8 @@
<Build Include="dbo\Views\DeviceView.sql" />
<Build Include="dbo\Views\HistoryView.sql" />
<Build Include="dbo\Views\CipherView.sql" />
<Build Include="dbo\Views\OrganizationUserView.sql" />
<Build Include="dbo\Views\OrganizationView.sql" />
<Build Include="dbo\Views\UserView.sql" />
<Build Include="dbo\Views\GrantView.sql" />
<Build Include="dbo\Stored Procedures\Cipher_Create.sql" />
@ -130,17 +132,15 @@
<Build Include="dbo\Stored Procedures\SubvaultUser_DeleteById.sql" />
<Build Include="dbo\Stored Procedures\SubvaultUser_ReadById.sql" />
<Build Include="dbo\Stored Procedures\SubvaultUser_Update.sql" />
<Build Include="dbo\Stored Procedures\Organization_ReadByIdUserId.sql" />
<Build Include="dbo\Stored Procedures\Organization_ReadByUserId.sql" />
<Build Include="dbo\Stored Procedures\Grant_DeleteByKey.sql" />
<Build Include="dbo\Stored Procedures\Grant_DeleteBySubjectIdClientId.sql" />
<Build Include="dbo\Stored Procedures\Grant_DeleteBySubjectIdClientIdType.sql" />
<Build Include="dbo\Stored Procedures\OrganizationUser_ReadByOrganizationIdUserId.sql" />
<Build Include="dbo\Stored Procedures\Grant_ReadByKey.sql" />
<Build Include="dbo\Stored Procedures\Grant_ReadBySubjectId.sql" />
<Build Include="dbo\Stored Procedures\Grant_Save.sql" />
<Build Include="dbo\Stored Procedures\User_ReadAccountRevisionDateById.sql" />
<Build Include="dbo\Stored Procedures\Organization_ReadByIdUserId.sql" />
<Build Include="dbo\Views\OrganizationView.sql" />
<Build Include="dbo\Views\OrganizationUserView.sql" />
<Build Include="dbo\Stored Procedures\OrganizationUser_ReadByIdUserId.sql" />
<Build Include="dbo\Stored Procedures\Organization_ReadByUserId.sql" />
</ItemGroup>
</Project>

View File

@ -1,5 +1,5 @@
CREATE PROCEDURE [dbo].[OrganizationUser_ReadByIdUserId]
@Id UNIQUEIDENTIFIER,
CREATE PROCEDURE [dbo].[OrganizationUser_ReadByOrganizationIdUserId]
@OrganizationId UNIQUEIDENTIFIER,
@UserId UNIQUEIDENTIFIER
AS
BEGIN
@ -10,6 +10,6 @@ BEGIN
FROM
[dbo].[OrganizationUserView]
WHERE
[Id] = @Id
[OrganizationId] = @OrganizationId
AND [UserId] = @UserId
END

View File

@ -2,7 +2,12 @@
@Id UNIQUEIDENTIFIER,
@UserId UNIQUEIDENTIFIER,
@Name NVARCHAR(50),
@Plan TINYINT,
@Plan NVARCHAR(20),
@PlanType TINYINT,
@PlanPrice MONEY,
@PlanRenewalPrice MONEY,
@PlanRenewalDate DATETIME2(7),
@PlanTrial BIT,
@MaxUsers SMALLINT,
@CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7)
@ -16,6 +21,11 @@ BEGIN
[UserId],
[Name],
[Plan],
[PlanType],
[PlanPrice],
[PlanRenewalPrice],
[PlanRenewalDate],
[PlanTrial],
[MaxUsers],
[CreationDate],
[RevisionDate]
@ -26,6 +36,11 @@ BEGIN
@UserId,
@Name,
@Plan,
@PlanType,
@PlanPrice,
@PlanRenewalPrice,
@PlanRenewalDate,
@PlanTrial,
@MaxUsers,
@CreationDate,
@RevisionDate

View File

@ -2,7 +2,12 @@
@Id UNIQUEIDENTIFIER,
@UserId UNIQUEIDENTIFIER,
@Name NVARCHAR(50),
@Plan TINYINT,
@Plan NVARCHAR(20),
@PlanType TINYINT,
@PlanPrice MONEY,
@PlanRenewalPrice MONEY,
@PlanRenewalDate DATETIME2(7),
@PlanTrial BIT,
@MaxUsers SMALLINT,
@CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7)
@ -16,6 +21,11 @@ BEGIN
[UserId] = @UserId,
[Name] = @Name,
[Plan] = @Plan,
[PlanType] = @PlanType,
[PlanPrice] = @PlanPrice,
[PlanRenewalPrice] = @PlanRenewalPrice,
[PlanRenewalDate] = @PlanRenewalDate,
[PlanTrial] = @PlanTrial,
[MaxUsers] = @MaxUsers,
[CreationDate] = @CreationDate,
[RevisionDate] = @RevisionDate

View File

@ -1,11 +1,16 @@
CREATE TABLE [dbo].[Organization] (
[Id] UNIQUEIDENTIFIER NOT NULL,
[UserId] UNIQUEIDENTIFIER NOT NULL,
[Name] NVARCHAR (50) NOT NULL,
[Plan] TINYINT NOT NULL,
[MaxUsers] SMALLINT NULL,
[CreationDate] DATETIME2 (7) NOT NULL,
[RevisionDate] DATETIME2 (7) NOT NULL,
[Id] UNIQUEIDENTIFIER NOT NULL,
[UserId] UNIQUEIDENTIFIER NOT NULL,
[Name] NVARCHAR (50) NOT NULL,
[Plan] NVARCHAR (20) NOT NULL,
[PlanType] TINYINT NOT NULL,
[PlanPrice] MONEY NOT NULL,
[PlanRenewalPrice] MONEY NOT NULL,
[PlanRenewalDate] DATETIME2 (7) NULL,
[PlanTrial] BIT NOT NULL,
[MaxUsers] SMALLINT NULL,
[CreationDate] DATETIME2 (7) NOT NULL,
[RevisionDate] DATETIME2 (7) NOT NULL,
CONSTRAINT [PK_Organization] PRIMARY KEY CLUSTERED ([Id] ASC),
CONSTRAINT [FK_Organization_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([Id])
);