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

[AC-2881] Remove Organization.FlexibleCollections from code (#4552)

* Remove Organization.FlexibleCollections from code

* Drop Organization.FlexibleCollections column in EF databases
(MSSQL column to be retained for 1 additional deployment to support rollback in cloud)
This commit is contained in:
Thomas Rittson
2024-07-26 15:07:33 +10:00
committed by GitHub
parent f9a1a6fc95
commit ffdc40b21c
25 changed files with 8188 additions and 87 deletions

View File

@ -99,12 +99,6 @@ public class Organization : ITableObject<Guid>, IStorableSubscriber, IRevisable,
/// If set to false, users generally need collection-level permissions to read/write a collection or its items.
/// </summary>
public bool AllowAdminAccessToAllCollectionItems { get; set; }
/// <summary>
/// This is an organization-level feature flag (not controlled via LaunchDarkly) to onboard organizations to the
/// Flexible Collections MVP changes. This has been fully released and must always be set to TRUE for all organizations.
/// AC-1714 will remove this flag after all old code has been removed.
/// </summary>
public bool FlexibleCollections { get; set; }
public void SetNewId()
{
@ -275,7 +269,6 @@ public class Organization : ITableObject<Guid>, IStorableSubscriber, IRevisable,
// The following properties are intentionally excluded from being updated:
// - Id - self-hosted org will have its own unique Guid
// - MaxStorageGb - not enforced for self-hosted because we're not providing the storage
// - FlexibleCollections - the self-hosted organization must do its own data migration to set this property, it cannot be updated from cloud
Name = license.Name;
BusinessName = license.BusinessName;

View File

@ -56,5 +56,4 @@ public class OrganizationUserOrganizationDetails
public int? SmServiceAccounts { get; set; }
public bool LimitCollectionCreationDeletion { get; set; }
public bool AllowAdminAccessToAllCollectionItems { get; set; }
public bool FlexibleCollections { get; set; }
}

View File

@ -42,5 +42,4 @@ public class ProviderUserOrganizationDetails
public PlanType PlanType { get; set; }
public bool LimitCollectionCreationDeletion { get; set; }
public bool AllowAdminAccessToAllCollectionItems { get; set; }
public bool FlexibleCollections { get; set; }
}

View File

@ -478,10 +478,6 @@ public class OrganizationService : IOrganizationService
// Secrets Manager not available for purchase with Consolidated Billing.
UseSecretsManager = false,
// Flexible Collections MVP is fully released and all organizations must always have this setting enabled.
// AC-1714 will remove this flag after all old code has been removed.
FlexibleCollections = true,
// This is a transitional setting that defaults to ON until Flexible Collections v1 is released
// (to preserve existing behavior) and defaults to OFF after release (enabling new behavior)
AllowAdminAccessToAllCollectionItems = !flexibleCollectionsV1Enabled
@ -568,10 +564,6 @@ public class OrganizationService : IOrganizationService
UsePasswordManager = true,
UseSecretsManager = signup.UseSecretsManager,
// Flexible Collections MVP is fully released and all organizations must always have this setting enabled.
// AC-1714 will remove this flag after all old code has been removed.
FlexibleCollections = true,
// This is a transitional setting that defaults to ON until Flexible Collections v1 is released
// (to preserve existing behavior) and defaults to OFF after release (enabling new behavior)
AllowAdminAccessToAllCollectionItems = !flexibleCollectionsV1IsEnabled
@ -696,10 +688,6 @@ public class OrganizationService : IOrganizationService
SmServiceAccounts = license.SmServiceAccounts,
LimitCollectionCreationDeletion = license.LimitCollectionCreationDeletion,
AllowAdminAccessToAllCollectionItems = license.AllowAdminAccessToAllCollectionItems,
// This feature flag indicates that new organizations should be automatically onboarded to
// Flexible Collections enhancements
FlexibleCollections = true,
};
var result = await SignUpAsync(organization, owner.Id, ownerKey, collectionName, false);
@ -2554,13 +2542,9 @@ public class OrganizationService : IOrganizationService
if (!string.IsNullOrWhiteSpace(collectionName))
{
// If using Flexible Collections, give the owner Can Manage access over the default collection
List<CollectionAccessSelection> defaultOwnerAccess = null;
if (org.FlexibleCollections)
{
defaultOwnerAccess =
[new CollectionAccessSelection { Id = organizationUserId, HidePasswords = false, ReadOnly = false, Manage = true }];
}
// give the owner Can Manage access over the default collection
List<CollectionAccessSelection> defaultOwnerAccess =
[new CollectionAccessSelection { Id = organizationUserId, HidePasswords = false, ReadOnly = false, Manage = true }];
var defaultCollection = new Collection
{