1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-01 13:43:23 +01:00

Simplify logic of a couple of conditionals

This commit is contained in:
Addison Beck 2024-10-04 14:32:16 -04:00
parent d9703a0b01
commit 0a80eb70b9
No known key found for this signature in database

View File

@ -126,9 +126,9 @@ public class BulkCollectionAuthorizationHandler : BulkAuthorizationHandler<BulkC
var organizationAbility = await GetOrganizationAbilityAsync(org); var organizationAbility = await GetOrganizationAbilityAsync(org);
var limitCollectionCreationEnabled = !(_featureService.IsEnabled(FeatureFlagKeys.LimitCollectionCreationDeletionSplit) var limitCollectionCreationEnabled = _featureService.IsEnabled(FeatureFlagKeys.LimitCollectionCreationDeletionSplit)
? organizationAbility is { LimitCollectionCreation: false } ? organizationAbility is { LimitCollectionCreation: true }
: organizationAbility is { LimitCollectionCreationDeletion: false }); : organizationAbility is { LimitCollectionCreationDeletion: true };
// If the limit collection management setting is disabled, allow any user to create collections // If the limit collection management setting is disabled, allow any user to create collections
if (!limitCollectionCreationEnabled) if (!limitCollectionCreationEnabled)
@ -264,9 +264,9 @@ public class BulkCollectionAuthorizationHandler : BulkAuthorizationHandler<BulkC
// If LimitCollectionCreationDeletion is true, only Owners and Admins can delete collections they manage // If LimitCollectionCreationDeletion is true, only Owners and Admins can delete collections they manage
var organizationAbility = await GetOrganizationAbilityAsync(org); var organizationAbility = await GetOrganizationAbilityAsync(org);
var limitCollectionDeletionEnabled = !(_featureService.IsEnabled(FeatureFlagKeys.LimitCollectionCreationDeletionSplit) var limitCollectionDeletionEnabled = _featureService.IsEnabled(FeatureFlagKeys.LimitCollectionCreationDeletionSplit)
? organizationAbility is { LimitCollectionDeletion: false } ? organizationAbility is { LimitCollectionDeletion: true }
: organizationAbility is { LimitCollectionCreationDeletion: false }); : organizationAbility is { LimitCollectionCreationDeletion: true };
var canDeleteManagedCollections = var canDeleteManagedCollections =
!limitCollectionDeletionEnabled || !limitCollectionDeletionEnabled ||