2025-02-14 21:05:49 +10:00
|
|
|
|
#nullable enable
|
|
|
|
|
|
|
|
|
|
|
|
using Bit.Core.AdminConsole.OrganizationFeatures.Policies.PolicyRequirements;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Bit.Core.AdminConsole.OrganizationFeatures.Policies;
|
|
|
|
|
|
|
|
|
|
|
|
public interface IPolicyRequirementQuery
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Get a policy requirement for a specific user.
|
|
|
|
|
|
/// The policy requirement represents how one or more policy types should be enforced against the user.
|
|
|
|
|
|
/// It will always return a value even if there are no policies that should be enforced.
|
|
|
|
|
|
/// This should be used for all policy checks.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="userId">The user that you need to enforce the policy against.</param>
|
|
|
|
|
|
/// <typeparam name="T">The IPolicyRequirement that corresponds to the policy you want to enforce.</typeparam>
|
|
|
|
|
|
Task<T> GetAsync<T>(Guid userId) where T : IPolicyRequirement;
|
2025-08-05 15:34:13 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2025-08-11 16:36:40 +01:00
|
|
|
|
/// Get all organization user IDs within an organization that are affected by a given policy type.
|
|
|
|
|
|
/// Respects role/status/provider exemptions via the policy factory's Enforce predicate.
|
2025-08-05 15:34:13 +01:00
|
|
|
|
/// </summary>
|
2025-08-11 16:36:40 +01:00
|
|
|
|
/// <param name="organizationId">The organization to check.</param>
|
|
|
|
|
|
/// <typeparam name="T">The IPolicyRequirement that corresponds to the policy type to evaluate.</typeparam>
|
|
|
|
|
|
/// <returns>Organization user IDs for whom the policy applies within the organization.</returns>
|
|
|
|
|
|
Task<IEnumerable<Guid>> GetManyByOrganizationIdAsync<T>(Guid organizationId) where T : IPolicyRequirement;
|
2025-02-14 21:05:49 +10:00
|
|
|
|
}
|