1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-05 13:08:17 -05:00

Switches to extension method

This commit is contained in:
jrmccannon 2025-03-28 09:24:03 -05:00
parent a1bd46febf
commit 32104a1fe3
No known key found for this signature in database
GPG Key ID: CF03F3DB01CE96A6
2 changed files with 6 additions and 6 deletions

View File

@ -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);
}

View File

@ -2,11 +2,11 @@
namespace Bit.Core.AdminConsole.OrganizationFeatures.OrganizationUsers.InviteUsers.Validation;
public static class InviteOrganizationUserFunctions
public static class CollectionAccessSelectionExtensions
{
/// <summary>
/// This
/// This validates the permissions on the given assigned collection
/// </summary>
public static Func<CollectionAccessSelection, bool> ValidateCollectionConfiguration => collectionAccessSelection =>
public static bool IsValidCollectionAccessConfiguration(this CollectionAccessSelection collectionAccessSelection) =>
collectionAccessSelection.Manage && (collectionAccessSelection.ReadOnly || collectionAccessSelection.HidePasswords);
}