mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 07:36:14 -05:00
[AC-2025] Add Organization.FlexibleCollections to database and sprocs (#3642)
* Add Organization.FlexibleCollections property and column * Add new property to OrganizationAbility * Add SQL and EF migrations
This commit is contained in:
@ -56,6 +56,7 @@ public class OrganizationResponseModel : ResponseModel
|
||||
MaxAutoscaleSmServiceAccounts = organization.MaxAutoscaleSmServiceAccounts;
|
||||
LimitCollectionCreationDeletion = organization.LimitCollectionCreationDeletion;
|
||||
AllowAdminAccessToAllCollectionItems = organization.AllowAdminAccessToAllCollectionItems;
|
||||
FlexibleCollections = organization.FlexibleCollections;
|
||||
}
|
||||
|
||||
public Guid Id { get; set; }
|
||||
@ -97,6 +98,7 @@ public class OrganizationResponseModel : ResponseModel
|
||||
public int? MaxAutoscaleSmServiceAccounts { get; set; }
|
||||
public bool LimitCollectionCreationDeletion { get; set; }
|
||||
public bool AllowAdminAccessToAllCollectionItems { get; set; }
|
||||
public bool FlexibleCollections { get; set; }
|
||||
}
|
||||
|
||||
public class OrganizationSubscriptionResponseModel : OrganizationResponseModel
|
||||
|
@ -61,6 +61,7 @@ public class ProfileOrganizationResponseModel : ResponseModel
|
||||
AccessSecretsManager = organization.AccessSecretsManager;
|
||||
LimitCollectionCreationDeletion = organization.LimitCollectionCreationDeletion;
|
||||
AllowAdminAccessToAllCollectionItems = organization.AllowAdminAccessToAllCollectionItems;
|
||||
FlexibleCollections = organization.FlexibleCollections;
|
||||
|
||||
if (organization.SsoConfig != null)
|
||||
{
|
||||
@ -116,4 +117,5 @@ public class ProfileOrganizationResponseModel : ResponseModel
|
||||
public bool AccessSecretsManager { get; set; }
|
||||
public bool LimitCollectionCreationDeletion { get; set; }
|
||||
public bool AllowAdminAccessToAllCollectionItems { get; set; }
|
||||
public bool FlexibleCollections { get; set; }
|
||||
}
|
||||
|
@ -91,6 +91,11 @@ public class Organization : ITableObject<Guid>, ISubscriber, IStorable, IStorabl
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public bool AllowAdminAccessToAllCollectionItems { get; set; }
|
||||
/// <summary>
|
||||
/// True if the organization is using the Flexible Collections permission changes, false otherwise.
|
||||
/// For existing organizations, this must only be set to true once data migrations have been run for this organization.
|
||||
/// </summary>
|
||||
public bool FlexibleCollections { get; set; }
|
||||
|
||||
public void SetNewId()
|
||||
{
|
||||
|
@ -23,6 +23,7 @@ public class OrganizationAbility
|
||||
UsePolicies = organization.UsePolicies;
|
||||
LimitCollectionCreationDeletion = organization.LimitCollectionCreationDeletion;
|
||||
AllowAdminAccessToAllCollectionItems = organization.AllowAdminAccessToAllCollectionItems;
|
||||
FlexibleCollections = organization.FlexibleCollections;
|
||||
}
|
||||
|
||||
public Guid Id { get; set; }
|
||||
@ -39,4 +40,5 @@ public class OrganizationAbility
|
||||
public bool UsePolicies { get; set; }
|
||||
public bool LimitCollectionCreationDeletion { get; set; }
|
||||
public bool AllowAdminAccessToAllCollectionItems { get; set; }
|
||||
public bool FlexibleCollections { get; set; }
|
||||
}
|
||||
|
@ -50,4 +50,5 @@ public class OrganizationUserOrganizationDetails
|
||||
public int? SmServiceAccounts { get; set; }
|
||||
public bool LimitCollectionCreationDeletion { get; set; }
|
||||
public bool AllowAdminAccessToAllCollectionItems { get; set; }
|
||||
public bool FlexibleCollections { get; set; }
|
||||
}
|
||||
|
@ -90,7 +90,8 @@ public class OrganizationRepository : Repository<Core.AdminConsole.Entities.Orga
|
||||
UseCustomPermissions = e.UseCustomPermissions,
|
||||
UsePolicies = e.UsePolicies,
|
||||
LimitCollectionCreationDeletion = e.LimitCollectionCreationDeletion,
|
||||
AllowAdminAccessToAllCollectionItems = e.AllowAdminAccessToAllCollectionItems
|
||||
AllowAdminAccessToAllCollectionItems = e.AllowAdminAccessToAllCollectionItems,
|
||||
FlexibleCollections = e.FlexibleCollections
|
||||
}).ToListAsync();
|
||||
}
|
||||
}
|
||||
|
@ -52,7 +52,8 @@
|
||||
@MaxAutoscaleSmServiceAccounts INT = null,
|
||||
@SecretsManagerBeta BIT = 0,
|
||||
@LimitCollectionCreationDeletion BIT = 1,
|
||||
@AllowAdminAccessToAllCollectionItems BIT = 1
|
||||
@AllowAdminAccessToAllCollectionItems BIT = 1,
|
||||
@FlexibleCollections BIT = 0
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
@ -112,7 +113,8 @@ BEGIN
|
||||
[MaxAutoscaleSmServiceAccounts],
|
||||
[SecretsManagerBeta],
|
||||
[LimitCollectionCreationDeletion],
|
||||
[AllowAdminAccessToAllCollectionItems]
|
||||
[AllowAdminAccessToAllCollectionItems],
|
||||
[FlexibleCollections]
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@ -169,6 +171,7 @@ BEGIN
|
||||
@MaxAutoscaleSmServiceAccounts,
|
||||
@SecretsManagerBeta,
|
||||
@LimitCollectionCreationDeletion,
|
||||
@AllowAdminAccessToAllCollectionItems
|
||||
@AllowAdminAccessToAllCollectionItems,
|
||||
@FlexibleCollections
|
||||
)
|
||||
END
|
||||
|
@ -22,7 +22,8 @@ BEGIN
|
||||
[UsePolicies],
|
||||
[Enabled],
|
||||
[LimitCollectionCreationDeletion],
|
||||
[AllowAdminAccessToAllCollectionItems]
|
||||
[AllowAdminAccessToAllCollectionItems],
|
||||
[FlexibleCollections]
|
||||
FROM
|
||||
[dbo].[Organization]
|
||||
END
|
||||
|
@ -52,7 +52,8 @@
|
||||
@MaxAutoscaleSmServiceAccounts INT = null,
|
||||
@SecretsManagerBeta BIT = 0,
|
||||
@LimitCollectionCreationDeletion BIT = 1,
|
||||
@AllowAdminAccessToAllCollectionItems BIT = 1
|
||||
@AllowAdminAccessToAllCollectionItems BIT = 1,
|
||||
@FlexibleCollections BIT = 0
|
||||
AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON
|
||||
@ -112,7 +113,8 @@ BEGIN
|
||||
[MaxAutoscaleSmServiceAccounts] = @MaxAutoscaleSmServiceAccounts,
|
||||
[SecretsManagerBeta] = @SecretsManagerBeta,
|
||||
[LimitCollectionCreationDeletion] = @LimitCollectionCreationDeletion,
|
||||
[AllowAdminAccessToAllCollectionItems] = @AllowAdminAccessToAllCollectionItems
|
||||
[AllowAdminAccessToAllCollectionItems] = @AllowAdminAccessToAllCollectionItems,
|
||||
[FlexibleCollections] = @FlexibleCollections
|
||||
WHERE
|
||||
[Id] = @Id
|
||||
END
|
||||
|
@ -53,6 +53,7 @@
|
||||
[SecretsManagerBeta] BIT NOT NULL CONSTRAINT [DF_Organization_SecretsManagerBeta] DEFAULT (0),
|
||||
[LimitCollectionCreationDeletion] BIT NOT NULL CONSTRAINT [DF_Organization_LimitCollectionCreationDeletion] DEFAULT (1),
|
||||
[AllowAdminAccessToAllCollectionItems] BIT NOT NULL CONSTRAINT [DF_Organization_AllowAdminAccessToAllCollectionItems] DEFAULT (1),
|
||||
[FlexibleCollections] BIT NOT NULL CONSTRAINT [DF_Organization_FlexibleCollections] DEFAULT (0)
|
||||
CONSTRAINT [PK_Organization] PRIMARY KEY CLUSTERED ([Id] ASC)
|
||||
);
|
||||
|
||||
|
@ -46,7 +46,8 @@ SELECT
|
||||
O.[SmSeats],
|
||||
O.[SmServiceAccounts],
|
||||
O.[LimitCollectionCreationDeletion],
|
||||
O.[AllowAdminAccessToAllCollectionItems]
|
||||
O.[AllowAdminAccessToAllCollectionItems],
|
||||
O.[FlexibleCollections]
|
||||
FROM
|
||||
[dbo].[OrganizationUser] OU
|
||||
LEFT JOIN
|
||||
|
Reference in New Issue
Block a user