#nullable enable using Bit.Core.Context; using Microsoft.AspNetCore.Authorization; namespace Bit.Api.AdminConsole.Authorization; /// /// A requirement that implements this interface will be handled by , /// which calls AuthorizeAsync with the organization details from the route. /// This is used for simple role-based checks. /// This may only be used on endpoints with {orgId} in their path. /// public interface IOrganizationRequirement : IAuthorizationRequirement { /// /// Whether to authorize a request that has this requirement. /// /// /// The CurrentContextOrganization for the user if they are a member of the organization. /// This is null if they are not a member. /// /// /// A callback that returns true if the user is a ProviderUser that manages the organization, otherwise false. /// This requires a database query, call it last. /// /// True if the requirement has been satisfied, otherwise false. public Task AuthorizeAsync( CurrentContextOrganization? organizationClaims, Func> isProviderUserForOrg); }