From 32104a1fe39905f0ac2b6bb8f223b16a1a25393d Mon Sep 17 00:00:00 2001 From: jrmccannon Date: Fri, 28 Mar 2025 09:24:03 -0500 Subject: [PATCH] Switches to extension method --- .../InviteUsers/Models/OrganizationUserInvite.cs | 6 +++--- ...rFunctions.cs => CollectionAccessSelectionExtensions.cs} | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) rename src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Validation/{InviteOrganizationUserFunctions.cs => CollectionAccessSelectionExtensions.cs} (54%) diff --git a/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Models/OrganizationUserInvite.cs b/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Models/OrganizationUserInvite.cs index c63c4598c4..5e183807e6 100644 --- a/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Models/OrganizationUserInvite.cs +++ b/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Models/OrganizationUserInvite.cs @@ -1,9 +1,9 @@ -using Bit.Core.Enums; +using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Validation; +using Bit.Core.Enums; using Bit.Core.Exceptions; using Bit.Core.Models.Data; using Bit.Core.Utilities; using static Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Models.InviteOrganizationUserErrorMessages; -using static Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Validation.InviteOrganizationUserFunctions; namespace Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Models; @@ -41,7 +41,7 @@ public class OrganizationUserInvite var collections = assignedCollections?.ToArray() ?? []; - if (collections.Any(ValidateCollectionConfiguration)) + if (collections.Any(x => x.IsValidCollectionAccessConfiguration())) { throw new BadRequestException(InvalidCollectionConfigurationErrorMessage); } diff --git a/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Validation/InviteOrganizationUserFunctions.cs b/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Validation/CollectionAccessSelectionExtensions.cs similarity index 54% rename from src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Validation/InviteOrganizationUserFunctions.cs rename to src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Validation/CollectionAccessSelectionExtensions.cs index 2d97a25721..7500ade672 100644 --- a/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Validation/InviteOrganizationUserFunctions.cs +++ b/src/Core/AdminConsole/OrganizationFeatures/OrganizationUsers/InviteUsers/Validation/CollectionAccessSelectionExtensions.cs @@ -2,11 +2,11 @@ namespace Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Validation; -public static class InviteOrganizationUserFunctions +public static class CollectionAccessSelectionExtensions { /// - /// This + /// This validates the permissions on the given assigned collection /// - public static Func ValidateCollectionConfiguration => collectionAccessSelection => + public static bool IsValidCollectionAccessConfiguration(this CollectionAccessSelection collectionAccessSelection) => collectionAccessSelection.Manage && (collectionAccessSelection.ReadOnly || collectionAccessSelection.HidePasswords); }