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:
parent
a1bd46febf
commit
32104a1fe3
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user