From 903c41294336eb137ca793ca683ff9cafe7e212e Mon Sep 17 00:00:00 2001 From: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Date: Tue, 23 Jul 2024 16:03:02 -0500 Subject: [PATCH] [AC-2648] Remove Organization.FlexibleCollections from Models (#4529) * chore: remove FlexibleCollections refs from OrganizationAbility, AC-2648 * chore: remove FlexibleCollections property from OrganizationResponseModel, refs AC-2648 * chore: remove FlexibleCollections from ProfileOrganizationResponseModel and ProfileProviderOrganizationResponseModel, refs AC-2648 * chore: remove FlexibleCollections from SelfHostedOrganizationDetails, refs AC-2648 --- .../OrganizationResponseModel.cs | 2 - .../ProfileOrganizationResponseModel.cs | 55 +++++++++---------- ...rofileProviderOrganizationResponseModel.cs | 1 - .../Data/Organizations/OrganizationAbility.cs | 2 - .../SelfHostedOrganizationDetails.cs | 1 - .../Repositories/OrganizationRepository.cs | 3 +- ...BulkCollectionAuthorizationHandlerTests.cs | 1 - 7 files changed, 26 insertions(+), 39 deletions(-) diff --git a/src/Api/AdminConsole/Models/Response/Organizations/OrganizationResponseModel.cs b/src/Api/AdminConsole/Models/Response/Organizations/OrganizationResponseModel.cs index 297ae247f3..08b4e4b063 100644 --- a/src/Api/AdminConsole/Models/Response/Organizations/OrganizationResponseModel.cs +++ b/src/Api/AdminConsole/Models/Response/Organizations/OrganizationResponseModel.cs @@ -57,7 +57,6 @@ public class OrganizationResponseModel : ResponseModel MaxAutoscaleSmServiceAccounts = organization.MaxAutoscaleSmServiceAccounts; LimitCollectionCreationDeletion = organization.LimitCollectionCreationDeletion; AllowAdminAccessToAllCollectionItems = organization.AllowAdminAccessToAllCollectionItems; - FlexibleCollections = organization.FlexibleCollections; } public Guid Id { get; set; } @@ -101,7 +100,6 @@ 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 diff --git a/src/Api/AdminConsole/Models/Response/ProfileOrganizationResponseModel.cs b/src/Api/AdminConsole/Models/Response/ProfileOrganizationResponseModel.cs index ae7f2cdff8..65b7a38a80 100644 --- a/src/Api/AdminConsole/Models/Response/ProfileOrganizationResponseModel.cs +++ b/src/Api/AdminConsole/Models/Response/ProfileOrganizationResponseModel.cs @@ -64,7 +64,6 @@ public class ProfileOrganizationResponseModel : ResponseModel AccessSecretsManager = organization.AccessSecretsManager; LimitCollectionCreationDeletion = organization.LimitCollectionCreationDeletion; AllowAdminAccessToAllCollectionItems = organization.AllowAdminAccessToAllCollectionItems; - FlexibleCollections = organization.FlexibleCollections; if (organization.SsoConfig != null) { @@ -73,39 +72,36 @@ public class ProfileOrganizationResponseModel : ResponseModel KeyConnectorUrl = ssoConfigData.KeyConnectorUrl; } - if (FlexibleCollections) + // Downgrade Custom users with no other permissions than 'Edit/Delete Assigned Collections' to User + if (Type == OrganizationUserType.Custom && Permissions is not null) { - // Downgrade Custom users with no other permissions than 'Edit/Delete Assigned Collections' to User - if (Type == OrganizationUserType.Custom && Permissions is not null) - { - if ((Permissions.EditAssignedCollections || Permissions.DeleteAssignedCollections) && - Permissions is - { - AccessEventLogs: false, - AccessImportExport: false, - AccessReports: false, - CreateNewCollections: false, - EditAnyCollection: false, - DeleteAnyCollection: false, - ManageGroups: false, - ManagePolicies: false, - ManageSso: false, - ManageUsers: false, - ManageResetPassword: false, - ManageScim: false - }) + if ((Permissions.EditAssignedCollections || Permissions.DeleteAssignedCollections) && + Permissions is { - organization.Type = OrganizationUserType.User; - } - } - - // Set 'Edit/Delete Assigned Collections' custom permissions to false - if (Permissions is not null) + AccessEventLogs: false, + AccessImportExport: false, + AccessReports: false, + CreateNewCollections: false, + EditAnyCollection: false, + DeleteAnyCollection: false, + ManageGroups: false, + ManagePolicies: false, + ManageSso: false, + ManageUsers: false, + ManageResetPassword: false, + ManageScim: false + }) { - Permissions.EditAssignedCollections = false; - Permissions.DeleteAssignedCollections = false; + organization.Type = OrganizationUserType.User; } } + + // Set 'Edit/Delete Assigned Collections' custom permissions to false + if (Permissions is not null) + { + Permissions.EditAssignedCollections = false; + Permissions.DeleteAssignedCollections = false; + } } public Guid Id { get; set; } @@ -157,5 +153,4 @@ public class ProfileOrganizationResponseModel : ResponseModel public bool AccessSecretsManager { get; set; } public bool LimitCollectionCreationDeletion { get; set; } public bool AllowAdminAccessToAllCollectionItems { get; set; } - public bool FlexibleCollections { get; set; } } diff --git a/src/Api/AdminConsole/Models/Response/ProfileProviderOrganizationResponseModel.cs b/src/Api/AdminConsole/Models/Response/ProfileProviderOrganizationResponseModel.cs index a7dbd02097..46819f8869 100644 --- a/src/Api/AdminConsole/Models/Response/ProfileProviderOrganizationResponseModel.cs +++ b/src/Api/AdminConsole/Models/Response/ProfileProviderOrganizationResponseModel.cs @@ -46,6 +46,5 @@ public class ProfileProviderOrganizationResponseModel : ProfileOrganizationRespo ProductTierType = StaticStore.GetPlan(organization.PlanType).ProductTier; LimitCollectionCreationDeletion = organization.LimitCollectionCreationDeletion; AllowAdminAccessToAllCollectionItems = organization.AllowAdminAccessToAllCollectionItems; - FlexibleCollections = organization.FlexibleCollections; } } diff --git a/src/Core/AdminConsole/Models/Data/Organizations/OrganizationAbility.cs b/src/Core/AdminConsole/Models/Data/Organizations/OrganizationAbility.cs index f867d18819..07db80d433 100644 --- a/src/Core/AdminConsole/Models/Data/Organizations/OrganizationAbility.cs +++ b/src/Core/AdminConsole/Models/Data/Organizations/OrganizationAbility.cs @@ -23,7 +23,6 @@ public class OrganizationAbility UsePolicies = organization.UsePolicies; LimitCollectionCreationDeletion = organization.LimitCollectionCreationDeletion; AllowAdminAccessToAllCollectionItems = organization.AllowAdminAccessToAllCollectionItems; - FlexibleCollections = organization.FlexibleCollections; } public Guid Id { get; set; } @@ -40,5 +39,4 @@ public class OrganizationAbility public bool UsePolicies { get; set; } public bool LimitCollectionCreationDeletion { get; set; } public bool AllowAdminAccessToAllCollectionItems { get; set; } - public bool FlexibleCollections { get; set; } } diff --git a/src/Core/AdminConsole/Models/Data/Organizations/SelfHostedOrganizationDetails.cs b/src/Core/AdminConsole/Models/Data/Organizations/SelfHostedOrganizationDetails.cs index 80a16e495a..d21ba91830 100644 --- a/src/Core/AdminConsole/Models/Data/Organizations/SelfHostedOrganizationDetails.cs +++ b/src/Core/AdminConsole/Models/Data/Organizations/SelfHostedOrganizationDetails.cs @@ -146,7 +146,6 @@ public class SelfHostedOrganizationDetails : Organization OwnersNotifiedOfAutoscaling = OwnersNotifiedOfAutoscaling, LimitCollectionCreationDeletion = LimitCollectionCreationDeletion, AllowAdminAccessToAllCollectionItems = AllowAdminAccessToAllCollectionItems, - FlexibleCollections = FlexibleCollections, Status = Status }; } diff --git a/src/Infrastructure.EntityFramework/AdminConsole/Repositories/OrganizationRepository.cs b/src/Infrastructure.EntityFramework/AdminConsole/Repositories/OrganizationRepository.cs index ee46643fe6..601ca1275b 100644 --- a/src/Infrastructure.EntityFramework/AdminConsole/Repositories/OrganizationRepository.cs +++ b/src/Infrastructure.EntityFramework/AdminConsole/Repositories/OrganizationRepository.cs @@ -100,8 +100,7 @@ public class OrganizationRepository : Repository