mirror of
https://github.com/bitwarden/server.git
synced 2025-07-15 14:47:45 -05:00
Fix logic and apply to controller
This commit is contained in:
@ -0,0 +1,15 @@
|
||||
#nullable enable
|
||||
|
||||
using Bit.Core.AdminConsole.OrganizationFeatures.Shared.Authorization;
|
||||
using Bit.Core.Context;
|
||||
|
||||
namespace Bit.Core.AdminConsole.OrganizationFeatures;
|
||||
|
||||
/// <summary>
|
||||
/// Requires that the user is a member of the organization or a provider for the organization.
|
||||
/// </summary>
|
||||
public class MemberOrProviderRequirement : IOrganizationRequirement
|
||||
{
|
||||
public async Task<bool> AuthorizeAsync(Guid organizationId, CurrentContextOrganization? organizationClaims, ICurrentContext currentContext)
|
||||
=> organizationClaims is not null || await currentContext.ProviderUserForOrgAsync(organizationId);
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
#nullable enable
|
||||
|
||||
using Bit.Core.AdminConsole.OrganizationFeatures.Shared.Authorization;
|
||||
using Bit.Core.Context;
|
||||
|
||||
namespace Bit.Core.AdminConsole.OrganizationFeatures;
|
||||
|
||||
public class OrganizationMemberRequirement : IOrganizationRequirement
|
||||
{
|
||||
public Task<bool> AuthorizeAsync(Guid organizationId, CurrentContextOrganization? organizationClaims, ICurrentContext currentContext)
|
||||
=> Task.FromResult(organizationClaims is not null);
|
||||
}
|
Reference in New Issue
Block a user