mirror of
https://github.com/bitwarden/server.git
synced 2025-04-08 22:58:11 -05:00
added org flag for UseEvents
This commit is contained in:
parent
2c4ce27ef2
commit
172fd2425e
@ -31,6 +31,7 @@ namespace Bit.Core.Models.Api
|
|||||||
MaxCollections = organization.MaxCollections;
|
MaxCollections = organization.MaxCollections;
|
||||||
UseGroups = organization.UseGroups;
|
UseGroups = organization.UseGroups;
|
||||||
UseDirectory = organization.UseDirectory;
|
UseDirectory = organization.UseDirectory;
|
||||||
|
UseEvents = organization.UseEvents;
|
||||||
UseTotp = organization.UseTotp;
|
UseTotp = organization.UseTotp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,6 +50,7 @@ namespace Bit.Core.Models.Api
|
|||||||
public short? MaxCollections { get; set; }
|
public short? MaxCollections { get; set; }
|
||||||
public bool UseGroups { get; set; }
|
public bool UseGroups { get; set; }
|
||||||
public bool UseDirectory { get; set; }
|
public bool UseDirectory { get; set; }
|
||||||
|
public bool UseEvents { get; set; }
|
||||||
public bool UseTotp { get; set; }
|
public bool UseTotp { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ namespace Bit.Core.Models.Api
|
|||||||
Name = organization.Name;
|
Name = organization.Name;
|
||||||
UseGroups = organization.UseGroups;
|
UseGroups = organization.UseGroups;
|
||||||
UseDirectory = organization.UseDirectory;
|
UseDirectory = organization.UseDirectory;
|
||||||
|
UseEvents = organization.UseEvents;
|
||||||
UseTotp = organization.UseTotp;
|
UseTotp = organization.UseTotp;
|
||||||
Seats = organization.Seats;
|
Seats = organization.Seats;
|
||||||
MaxCollections = organization.MaxCollections;
|
MaxCollections = organization.MaxCollections;
|
||||||
@ -26,6 +27,7 @@ namespace Bit.Core.Models.Api
|
|||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public bool UseGroups { get; set; }
|
public bool UseGroups { get; set; }
|
||||||
public bool UseDirectory { get; set; }
|
public bool UseDirectory { get; set; }
|
||||||
|
public bool UseEvents { get; set; }
|
||||||
public bool UseTotp { get; set; }
|
public bool UseTotp { get; set; }
|
||||||
public int Seats { get; set; }
|
public int Seats { get; set; }
|
||||||
public int MaxCollections { get; set; }
|
public int MaxCollections { get; set; }
|
||||||
|
@ -19,7 +19,7 @@ namespace Bit.Core.Models.Business
|
|||||||
public OrganizationLicense(Organization org, BillingInfo billingInfo, Guid installationId,
|
public OrganizationLicense(Organization org, BillingInfo billingInfo, Guid installationId,
|
||||||
ILicensingService licenseService)
|
ILicensingService licenseService)
|
||||||
{
|
{
|
||||||
Version = 2;
|
Version = 3;
|
||||||
LicenseKey = org.LicenseKey;
|
LicenseKey = org.LicenseKey;
|
||||||
InstallationId = installationId;
|
InstallationId = installationId;
|
||||||
Id = org.Id;
|
Id = org.Id;
|
||||||
@ -32,6 +32,7 @@ namespace Bit.Core.Models.Business
|
|||||||
Seats = org.Seats;
|
Seats = org.Seats;
|
||||||
MaxCollections = org.MaxCollections;
|
MaxCollections = org.MaxCollections;
|
||||||
UseGroups = org.UseGroups;
|
UseGroups = org.UseGroups;
|
||||||
|
UseEvents = org.UseEvents;
|
||||||
UseDirectory = org.UseDirectory;
|
UseDirectory = org.UseDirectory;
|
||||||
UseTotp = org.UseTotp;
|
UseTotp = org.UseTotp;
|
||||||
MaxStorageGb = org.MaxStorageGb;
|
MaxStorageGb = org.MaxStorageGb;
|
||||||
@ -96,6 +97,7 @@ namespace Bit.Core.Models.Business
|
|||||||
public short? Seats { get; set; }
|
public short? Seats { get; set; }
|
||||||
public short? MaxCollections { get; set; }
|
public short? MaxCollections { get; set; }
|
||||||
public bool UseGroups { get; set; }
|
public bool UseGroups { get; set; }
|
||||||
|
public bool UseEvents { get; set; }
|
||||||
public bool UseDirectory { get; set; }
|
public bool UseDirectory { get; set; }
|
||||||
public bool UseTotp { get; set; }
|
public bool UseTotp { get; set; }
|
||||||
public short? MaxStorageGb { get; set; }
|
public short? MaxStorageGb { get; set; }
|
||||||
@ -114,7 +116,7 @@ namespace Bit.Core.Models.Business
|
|||||||
public byte[] GetDataBytes(bool forHash = false)
|
public byte[] GetDataBytes(bool forHash = false)
|
||||||
{
|
{
|
||||||
string data = null;
|
string data = null;
|
||||||
if(Version == 1 || Version == 2)
|
if(Version >= 1 && Version <= 3)
|
||||||
{
|
{
|
||||||
var props = typeof(OrganizationLicense)
|
var props = typeof(OrganizationLicense)
|
||||||
.GetProperties(BindingFlags.Public | BindingFlags.Instance)
|
.GetProperties(BindingFlags.Public | BindingFlags.Instance)
|
||||||
@ -122,7 +124,9 @@ namespace Bit.Core.Models.Business
|
|||||||
!p.Name.Equals(nameof(Signature)) &&
|
!p.Name.Equals(nameof(Signature)) &&
|
||||||
!p.Name.Equals(nameof(SignatureBytes)) &&
|
!p.Name.Equals(nameof(SignatureBytes)) &&
|
||||||
// UsersGetPremium was added in Version 2
|
// UsersGetPremium was added in Version 2
|
||||||
(Version > 1 || !p.Name.Equals(nameof(UsersGetPremium))) &&
|
(Version >= 2 || !p.Name.Equals(nameof(UsersGetPremium))) &&
|
||||||
|
// UseEvents was added in Version 3
|
||||||
|
(Version >= 3 || !p.Name.Equals(nameof(UseEvents))) &&
|
||||||
(
|
(
|
||||||
!forHash ||
|
!forHash ||
|
||||||
(
|
(
|
||||||
@ -159,7 +163,7 @@ namespace Bit.Core.Models.Business
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Version == 1 || Version == 2)
|
if(Version >= 1 && Version <= 3)
|
||||||
{
|
{
|
||||||
return InstallationId == globalSettings.Installation.Id && SelfHost;
|
return InstallationId == globalSettings.Installation.Id && SelfHost;
|
||||||
}
|
}
|
||||||
@ -176,7 +180,7 @@ namespace Bit.Core.Models.Business
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Version == 1 || Version == 2)
|
if(Version >= 1 && Version <= 3)
|
||||||
{
|
{
|
||||||
var valid =
|
var valid =
|
||||||
globalSettings.Installation.Id == InstallationId &&
|
globalSettings.Installation.Id == InstallationId &&
|
||||||
@ -191,11 +195,16 @@ namespace Bit.Core.Models.Business
|
|||||||
organization.SelfHost == SelfHost &&
|
organization.SelfHost == SelfHost &&
|
||||||
organization.Name.Equals(Name);
|
organization.Name.Equals(Name);
|
||||||
|
|
||||||
if(valid && Version == 2)
|
if(valid && Version >= 2)
|
||||||
{
|
{
|
||||||
valid = organization.UsersGetPremium == UsersGetPremium;
|
valid = organization.UsersGetPremium == UsersGetPremium;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(valid && Version >= 3)
|
||||||
|
{
|
||||||
|
valid = organization.UseEvents == UseEvents;
|
||||||
|
}
|
||||||
|
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -9,6 +9,7 @@ namespace Bit.Core.Models.Data
|
|||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public bool UseGroups { get; set; }
|
public bool UseGroups { get; set; }
|
||||||
public bool UseDirectory { get; set; }
|
public bool UseDirectory { get; set; }
|
||||||
|
public bool UseEvents { get; set; }
|
||||||
public bool UseTotp { get; set; }
|
public bool UseTotp { get; set; }
|
||||||
public bool SelfHost { get; set; }
|
public bool SelfHost { get; set; }
|
||||||
public bool UsersGetPremium { get; set; }
|
public bool UsersGetPremium { get; set; }
|
||||||
|
@ -14,6 +14,7 @@ namespace Bit.Core.Models.StaticStore
|
|||||||
public short? MaxAdditionalSeats { get; set; }
|
public short? MaxAdditionalSeats { get; set; }
|
||||||
public bool UseGroups { get; set; }
|
public bool UseGroups { get; set; }
|
||||||
public bool UseDirectory { get; set; }
|
public bool UseDirectory { get; set; }
|
||||||
|
public bool UseEvents { get; set; }
|
||||||
public bool UseTotp { get; set; }
|
public bool UseTotp { get; set; }
|
||||||
public short? MaxStorageGb { get; set; }
|
public short? MaxStorageGb { get; set; }
|
||||||
public decimal BasePrice { get; set; }
|
public decimal BasePrice { get; set; }
|
||||||
|
@ -23,6 +23,7 @@ namespace Bit.Core.Models.Table
|
|||||||
public short? MaxCollections { get; set; }
|
public short? MaxCollections { get; set; }
|
||||||
public bool UseGroups { get; set; }
|
public bool UseGroups { get; set; }
|
||||||
public bool UseDirectory { get; set; }
|
public bool UseDirectory { get; set; }
|
||||||
|
public bool UseEvents { get; set; }
|
||||||
public bool UseTotp { get; set; }
|
public bool UseTotp { get; set; }
|
||||||
public bool SelfHost { get; set; }
|
public bool SelfHost { get; set; }
|
||||||
public bool UsersGetPremium { get; set; }
|
public bool UsersGetPremium { get; set; }
|
||||||
|
@ -527,6 +527,7 @@ namespace Bit.Core.Services
|
|||||||
MaxStorageGb = !plan.MaxStorageGb.HasValue ?
|
MaxStorageGb = !plan.MaxStorageGb.HasValue ?
|
||||||
(short?)null : (short)(plan.MaxStorageGb.Value + signup.AdditionalStorageGb),
|
(short?)null : (short)(plan.MaxStorageGb.Value + signup.AdditionalStorageGb),
|
||||||
UseGroups = plan.UseGroups,
|
UseGroups = plan.UseGroups,
|
||||||
|
UseEvents = plan.UseEvents,
|
||||||
UseDirectory = plan.UseDirectory,
|
UseDirectory = plan.UseDirectory,
|
||||||
UseTotp = plan.UseTotp,
|
UseTotp = plan.UseTotp,
|
||||||
SelfHost = plan.SelfHost,
|
SelfHost = plan.SelfHost,
|
||||||
@ -582,6 +583,7 @@ namespace Bit.Core.Services
|
|||||||
MaxStorageGb = _globalSettings.SelfHosted ? 10240 : license.MaxStorageGb, // 10 TB
|
MaxStorageGb = _globalSettings.SelfHosted ? 10240 : license.MaxStorageGb, // 10 TB
|
||||||
UseGroups = license.UseGroups,
|
UseGroups = license.UseGroups,
|
||||||
UseDirectory = license.UseDirectory,
|
UseDirectory = license.UseDirectory,
|
||||||
|
UseEvents = license.UseEvents,
|
||||||
UseTotp = license.UseTotp,
|
UseTotp = license.UseTotp,
|
||||||
Plan = license.Plan,
|
Plan = license.Plan,
|
||||||
SelfHost = license.SelfHost,
|
SelfHost = license.SelfHost,
|
||||||
@ -744,6 +746,7 @@ namespace Bit.Core.Services
|
|||||||
organization.MaxCollections = license.MaxCollections;
|
organization.MaxCollections = license.MaxCollections;
|
||||||
organization.UseGroups = license.UseGroups;
|
organization.UseGroups = license.UseGroups;
|
||||||
organization.UseDirectory = license.UseDirectory;
|
organization.UseDirectory = license.UseDirectory;
|
||||||
|
organization.UseEvents = license.UseEvents;
|
||||||
organization.UseTotp = license.UseTotp;
|
organization.UseTotp = license.UseTotp;
|
||||||
organization.Plan = license.Plan;
|
organization.Plan = license.Plan;
|
||||||
organization.Enabled = license.Enabled;
|
organization.Enabled = license.Enabled;
|
||||||
|
@ -161,6 +161,7 @@ namespace Bit.Core.Utilities
|
|||||||
TrialPeriodDays = 7,
|
TrialPeriodDays = 7,
|
||||||
UseGroups = true,
|
UseGroups = true,
|
||||||
UseDirectory = true,
|
UseDirectory = true,
|
||||||
|
UseEvents = true,
|
||||||
UseTotp = true,
|
UseTotp = true,
|
||||||
MaxStorageGb = 1,
|
MaxStorageGb = 1,
|
||||||
SelfHost = true,
|
SelfHost = true,
|
||||||
@ -181,6 +182,7 @@ namespace Bit.Core.Utilities
|
|||||||
TrialPeriodDays = 7,
|
TrialPeriodDays = 7,
|
||||||
UseGroups = true,
|
UseGroups = true,
|
||||||
UseDirectory = true,
|
UseDirectory = true,
|
||||||
|
UseEvents = true,
|
||||||
UseTotp = true,
|
UseTotp = true,
|
||||||
MaxStorageGb = 1,
|
MaxStorageGb = 1,
|
||||||
SelfHost = true,
|
SelfHost = true,
|
||||||
|
@ -218,5 +218,6 @@
|
|||||||
<Build Include="dbo\Stored Procedures\User_BumpAccountRevisionDateByCipherId.sql" />
|
<Build Include="dbo\Stored Procedures\User_BumpAccountRevisionDateByCipherId.sql" />
|
||||||
<Build Include="dbo\Tables\Event.sql" />
|
<Build Include="dbo\Tables\Event.sql" />
|
||||||
<Build Include="dbo\Stored Procedures\Event_Create.sql" />
|
<Build Include="dbo\Stored Procedures\Event_Create.sql" />
|
||||||
|
<Build Include="dbo\Views\EventView.sql" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -14,6 +14,7 @@
|
|||||||
@MaxCollections SMALLINT,
|
@MaxCollections SMALLINT,
|
||||||
@UseGroups BIT,
|
@UseGroups BIT,
|
||||||
@UseDirectory BIT,
|
@UseDirectory BIT,
|
||||||
|
@UseEvents BIT,
|
||||||
@UseTotp BIT,
|
@UseTotp BIT,
|
||||||
@SelfHost BIT,
|
@SelfHost BIT,
|
||||||
@UsersGetPremium BIT,
|
@UsersGetPremium BIT,
|
||||||
@ -48,6 +49,7 @@ BEGIN
|
|||||||
[MaxCollections],
|
[MaxCollections],
|
||||||
[UseGroups],
|
[UseGroups],
|
||||||
[UseDirectory],
|
[UseDirectory],
|
||||||
|
[UseEvents],
|
||||||
[UseTotp],
|
[UseTotp],
|
||||||
[SelfHost],
|
[SelfHost],
|
||||||
[UsersGetPremium],
|
[UsersGetPremium],
|
||||||
@ -79,6 +81,7 @@ BEGIN
|
|||||||
@MaxCollections,
|
@MaxCollections,
|
||||||
@UseGroups,
|
@UseGroups,
|
||||||
@UseDirectory,
|
@UseDirectory,
|
||||||
|
@UseEvents,
|
||||||
@UseTotp,
|
@UseTotp,
|
||||||
@SelfHost,
|
@SelfHost,
|
||||||
@UsersGetPremium,
|
@UsersGetPremium,
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
@MaxCollections SMALLINT,
|
@MaxCollections SMALLINT,
|
||||||
@UseGroups BIT,
|
@UseGroups BIT,
|
||||||
@UseDirectory BIT,
|
@UseDirectory BIT,
|
||||||
|
@UseEvents BIT,
|
||||||
@UseTotp BIT,
|
@UseTotp BIT,
|
||||||
@SelfHost BIT,
|
@SelfHost BIT,
|
||||||
@UsersGetPremium BIT,
|
@UsersGetPremium BIT,
|
||||||
@ -48,6 +49,7 @@ BEGIN
|
|||||||
[MaxCollections] = @MaxCollections,
|
[MaxCollections] = @MaxCollections,
|
||||||
[UseGroups] = @UseGroups,
|
[UseGroups] = @UseGroups,
|
||||||
[UseDirectory] = @UseDirectory,
|
[UseDirectory] = @UseDirectory,
|
||||||
|
[UseEvents] = @UseEvents,
|
||||||
[UseTotp] = @UseTotp,
|
[UseTotp] = @UseTotp,
|
||||||
[SelfHost] = @SelfHost,
|
[SelfHost] = @SelfHost,
|
||||||
[UsersGetPremium] = @UsersGetPremium,
|
[UsersGetPremium] = @UsersGetPremium,
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
[MaxCollections] SMALLINT NULL,
|
[MaxCollections] SMALLINT NULL,
|
||||||
[UseGroups] BIT NOT NULL,
|
[UseGroups] BIT NOT NULL,
|
||||||
[UseDirectory] BIT NOT NULL,
|
[UseDirectory] BIT NOT NULL,
|
||||||
|
[UseEvents] BIT NOT NULL,
|
||||||
[UseTotp] BIT NOT NULL,
|
[UseTotp] BIT NOT NULL,
|
||||||
[SelfHost] BIT NOT NULL,
|
[SelfHost] BIT NOT NULL,
|
||||||
[UsersGetPremium] BIT NOT NULL,
|
[UsersGetPremium] BIT NOT NULL,
|
||||||
|
6
src/Sql/dbo/Views/EventView.sql
Normal file
6
src/Sql/dbo/Views/EventView.sql
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
CREATE VIEW [dbo].[EventView]
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
[dbo].[Event]
|
@ -7,6 +7,7 @@ SELECT
|
|||||||
O.[Enabled],
|
O.[Enabled],
|
||||||
O.[UseGroups],
|
O.[UseGroups],
|
||||||
O.[UseDirectory],
|
O.[UseDirectory],
|
||||||
|
O.[UseEvents],
|
||||||
O.[UseTotp],
|
O.[UseTotp],
|
||||||
O.[SelfHost],
|
O.[SelfHost],
|
||||||
O.[UsersGetPremium],
|
O.[UsersGetPremium],
|
||||||
|
@ -1,4 +1,253 @@
|
|||||||
IF OBJECT_ID('[dbo].[Event]') IS NULL
|
IF COL_LENGTH('[dbo].[Organization]', 'UseEvents') IS NULL
|
||||||
|
BEGIN
|
||||||
|
ALTER TABLE
|
||||||
|
[dbo].[Organization]
|
||||||
|
ADD
|
||||||
|
[UseEvents] BIT NULL
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
UPDATE
|
||||||
|
[dbo].[Organization]
|
||||||
|
SET
|
||||||
|
[UseEvents] = (CASE WHEN [PlanType] = 5 OR [PlanType] = 4 THEN 1 ELSE 0 END)
|
||||||
|
GO
|
||||||
|
|
||||||
|
ALTER TABLE
|
||||||
|
[dbo].[Organization]
|
||||||
|
ALTER COLUMN
|
||||||
|
[UseEvents] BIT NOT NULL
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF OBJECT_ID('[dbo].[Organization_Create]') IS NOT NULL
|
||||||
|
BEGIN
|
||||||
|
DROP PROCEDURE [dbo].[Organization_Create]
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[Organization_Create]
|
||||||
|
@Id UNIQUEIDENTIFIER,
|
||||||
|
@Name NVARCHAR(50),
|
||||||
|
@BusinessName NVARCHAR(50),
|
||||||
|
@BusinessAddress1 NVARCHAR(50),
|
||||||
|
@BusinessAddress2 NVARCHAR(50),
|
||||||
|
@BusinessAddress3 NVARCHAR(50),
|
||||||
|
@BusinessCountry VARCHAR(2),
|
||||||
|
@BusinessTaxNumber NVARCHAR(30),
|
||||||
|
@BillingEmail NVARCHAR(50),
|
||||||
|
@Plan NVARCHAR(50),
|
||||||
|
@PlanType TINYINT,
|
||||||
|
@Seats SMALLINT,
|
||||||
|
@MaxCollections SMALLINT,
|
||||||
|
@UseGroups BIT,
|
||||||
|
@UseDirectory BIT,
|
||||||
|
@UseEvents BIT,
|
||||||
|
@UseTotp BIT,
|
||||||
|
@SelfHost BIT,
|
||||||
|
@UsersGetPremium BIT,
|
||||||
|
@Storage BIGINT,
|
||||||
|
@MaxStorageGb SMALLINT,
|
||||||
|
@Gateway TINYINT,
|
||||||
|
@GatewayCustomerId VARCHAR(50),
|
||||||
|
@GatewaySubscriptionId VARCHAR(50),
|
||||||
|
@Enabled BIT,
|
||||||
|
@LicenseKey VARCHAR(100),
|
||||||
|
@ExpirationDate DATETIME2(7),
|
||||||
|
@CreationDate DATETIME2(7),
|
||||||
|
@RevisionDate DATETIME2(7)
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
SET NOCOUNT ON
|
||||||
|
|
||||||
|
INSERT INTO [dbo].[Organization]
|
||||||
|
(
|
||||||
|
[Id],
|
||||||
|
[Name],
|
||||||
|
[BusinessName],
|
||||||
|
[BusinessAddress1],
|
||||||
|
[BusinessAddress2],
|
||||||
|
[BusinessAddress3],
|
||||||
|
[BusinessCountry],
|
||||||
|
[BusinessTaxNumber],
|
||||||
|
[BillingEmail],
|
||||||
|
[Plan],
|
||||||
|
[PlanType],
|
||||||
|
[Seats],
|
||||||
|
[MaxCollections],
|
||||||
|
[UseGroups],
|
||||||
|
[UseDirectory],
|
||||||
|
[UseEvents],
|
||||||
|
[UseTotp],
|
||||||
|
[SelfHost],
|
||||||
|
[UsersGetPremium],
|
||||||
|
[Storage],
|
||||||
|
[MaxStorageGb],
|
||||||
|
[Gateway],
|
||||||
|
[GatewayCustomerId],
|
||||||
|
[GatewaySubscriptionId],
|
||||||
|
[Enabled],
|
||||||
|
[LicenseKey],
|
||||||
|
[ExpirationDate],
|
||||||
|
[CreationDate],
|
||||||
|
[RevisionDate]
|
||||||
|
)
|
||||||
|
VALUES
|
||||||
|
(
|
||||||
|
@Id,
|
||||||
|
@Name,
|
||||||
|
@BusinessName,
|
||||||
|
@BusinessAddress1,
|
||||||
|
@BusinessAddress2,
|
||||||
|
@BusinessAddress3,
|
||||||
|
@BusinessCountry,
|
||||||
|
@BusinessTaxNumber,
|
||||||
|
@BillingEmail,
|
||||||
|
@Plan,
|
||||||
|
@PlanType,
|
||||||
|
@Seats,
|
||||||
|
@MaxCollections,
|
||||||
|
@UseGroups,
|
||||||
|
@UseDirectory,
|
||||||
|
@UseEvents,
|
||||||
|
@UseTotp,
|
||||||
|
@SelfHost,
|
||||||
|
@UsersGetPremium,
|
||||||
|
@Storage,
|
||||||
|
@MaxStorageGb,
|
||||||
|
@Gateway,
|
||||||
|
@GatewayCustomerId,
|
||||||
|
@GatewaySubscriptionId,
|
||||||
|
@Enabled,
|
||||||
|
@LicenseKey,
|
||||||
|
@ExpirationDate,
|
||||||
|
@CreationDate,
|
||||||
|
@RevisionDate
|
||||||
|
)
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF OBJECT_ID('[dbo].[Organization_Update]') IS NOT NULL
|
||||||
|
BEGIN
|
||||||
|
DROP PROCEDURE [dbo].[Organization_Update]
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE PROCEDURE [dbo].[Organization_Update]
|
||||||
|
@Id UNIQUEIDENTIFIER,
|
||||||
|
@Name NVARCHAR(50),
|
||||||
|
@BusinessName NVARCHAR(50),
|
||||||
|
@BusinessAddress1 NVARCHAR(50),
|
||||||
|
@BusinessAddress2 NVARCHAR(50),
|
||||||
|
@BusinessAddress3 NVARCHAR(50),
|
||||||
|
@BusinessCountry VARCHAR(2),
|
||||||
|
@BusinessTaxNumber NVARCHAR(30),
|
||||||
|
@BillingEmail NVARCHAR(50),
|
||||||
|
@Plan NVARCHAR(50),
|
||||||
|
@PlanType TINYINT,
|
||||||
|
@Seats SMALLINT,
|
||||||
|
@MaxCollections SMALLINT,
|
||||||
|
@UseGroups BIT,
|
||||||
|
@UseDirectory BIT,
|
||||||
|
@UseEvents BIT,
|
||||||
|
@UseTotp BIT,
|
||||||
|
@SelfHost BIT,
|
||||||
|
@UsersGetPremium BIT,
|
||||||
|
@Storage BIGINT,
|
||||||
|
@MaxStorageGb SMALLINT,
|
||||||
|
@Gateway TINYINT,
|
||||||
|
@GatewayCustomerId VARCHAR(50),
|
||||||
|
@GatewaySubscriptionId VARCHAR(50),
|
||||||
|
@Enabled BIT,
|
||||||
|
@LicenseKey VARCHAR(100),
|
||||||
|
@ExpirationDate DATETIME2(7),
|
||||||
|
@CreationDate DATETIME2(7),
|
||||||
|
@RevisionDate DATETIME2(7)
|
||||||
|
AS
|
||||||
|
BEGIN
|
||||||
|
SET NOCOUNT ON
|
||||||
|
|
||||||
|
UPDATE
|
||||||
|
[dbo].[Organization]
|
||||||
|
SET
|
||||||
|
[Name] = @Name,
|
||||||
|
[BusinessName] = @BusinessName,
|
||||||
|
[BusinessAddress1] = @BusinessAddress1,
|
||||||
|
[BusinessAddress2] = @BusinessAddress2,
|
||||||
|
[BusinessAddress3] = @BusinessAddress3,
|
||||||
|
[BusinessCountry] = @BusinessCountry,
|
||||||
|
[BusinessTaxNumber] = @BusinessTaxNumber,
|
||||||
|
[BillingEmail] = @BillingEmail,
|
||||||
|
[Plan] = @Plan,
|
||||||
|
[PlanType] = @PlanType,
|
||||||
|
[Seats] = @Seats,
|
||||||
|
[MaxCollections] = @MaxCollections,
|
||||||
|
[UseGroups] = @UseGroups,
|
||||||
|
[UseDirectory] = @UseDirectory,
|
||||||
|
[UseEvents] = @UseEvents,
|
||||||
|
[UseTotp] = @UseTotp,
|
||||||
|
[SelfHost] = @SelfHost,
|
||||||
|
[UsersGetPremium] = @UsersGetPremium,
|
||||||
|
[Storage] = @Storage,
|
||||||
|
[MaxStorageGb] = @MaxStorageGb,
|
||||||
|
[Gateway] = @Gateway,
|
||||||
|
[GatewayCustomerId] = @GatewayCustomerId,
|
||||||
|
[GatewaySubscriptionId] = @GatewaySubscriptionId,
|
||||||
|
[Enabled] = @Enabled,
|
||||||
|
[LicenseKey] = @LicenseKey,
|
||||||
|
[ExpirationDate] = @ExpirationDate,
|
||||||
|
[CreationDate] = @CreationDate,
|
||||||
|
[RevisionDate] = @RevisionDate
|
||||||
|
WHERE
|
||||||
|
[Id] = @Id
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS(SELECT * FROM sys.views WHERE [Name] = 'OrganizationView')
|
||||||
|
BEGIN
|
||||||
|
DROP VIEW [dbo].[OrganizationView]
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE VIEW [dbo].[OrganizationView]
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
[dbo].[Organization]
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF EXISTS(SELECT * FROM sys.views WHERE [Name] = 'OrganizationUserOrganizationDetailsView')
|
||||||
|
BEGIN
|
||||||
|
DROP VIEW [dbo].[OrganizationUserOrganizationDetailsView]
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE VIEW [dbo].[OrganizationUserOrganizationDetailsView]
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
OU.[UserId],
|
||||||
|
OU.[OrganizationId],
|
||||||
|
O.[Name],
|
||||||
|
O.[Enabled],
|
||||||
|
O.[UseGroups],
|
||||||
|
O.[UseDirectory],
|
||||||
|
O.[UseEvents],
|
||||||
|
O.[UseTotp],
|
||||||
|
O.[SelfHost],
|
||||||
|
O.[UsersGetPremium],
|
||||||
|
O.[Seats],
|
||||||
|
O.[MaxCollections],
|
||||||
|
O.[MaxStorageGb],
|
||||||
|
OU.[Key],
|
||||||
|
OU.[Status],
|
||||||
|
OU.[Type]
|
||||||
|
FROM
|
||||||
|
[dbo].[OrganizationUser] OU
|
||||||
|
INNER JOIN
|
||||||
|
[dbo].[Organization] O ON O.[Id] = OU.[OrganizationId]
|
||||||
|
GO
|
||||||
|
|
||||||
|
IF OBJECT_ID('[dbo].[Event]') IS NULL
|
||||||
BEGIN
|
BEGIN
|
||||||
CREATE TABLE [dbo].[Event] (
|
CREATE TABLE [dbo].[Event] (
|
||||||
[Id] UNIQUEIDENTIFIER NOT NULL,
|
[Id] UNIQUEIDENTIFIER NOT NULL,
|
||||||
@ -68,3 +317,17 @@ BEGIN
|
|||||||
)
|
)
|
||||||
END
|
END
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
IF EXISTS(SELECT * FROM sys.views WHERE [Name] = 'EventView')
|
||||||
|
BEGIN
|
||||||
|
DROP VIEW [dbo].[EventView]
|
||||||
|
END
|
||||||
|
GO
|
||||||
|
|
||||||
|
CREATE VIEW [dbo].[EventView]
|
||||||
|
AS
|
||||||
|
SELECT
|
||||||
|
*
|
||||||
|
FROM
|
||||||
|
[dbo].[Event]
|
||||||
|
GO
|
||||||
|
Loading…
x
Reference in New Issue
Block a user