mirror of
https://github.com/bitwarden/server.git
synced 2025-05-22 20:11:04 -05:00
Add interfaces for organization policy requirements and factory in the Policies namespace
This commit is contained in:
parent
ee660b25b7
commit
2fef097d2c
@ -0,0 +1,19 @@
|
||||
#nullable enable
|
||||
|
||||
using Bit.Core.AdminConsole.OrganizationFeatures.Policies.PolicyRequirements;
|
||||
|
||||
namespace Bit.Core.AdminConsole.OrganizationFeatures.Policies;
|
||||
|
||||
/// <summary>
|
||||
/// Query interface for retrieving policy requirements based on organization ID
|
||||
/// </summary>
|
||||
public interface IOrganizationPolicyRequirementQuery
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a policy requirement of type T for an organization
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of policy requirement to retrieve</typeparam>
|
||||
/// <param name="organizationId">The organization ID to get policy requirements for</param>
|
||||
/// <returns>The policy requirement of type T</returns>
|
||||
Task<T> GetAsync<T>(Guid organizationId) where T : IPolicyRequirement;
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
#nullable enable
|
||||
|
||||
using Bit.Core.AdminConsole.Entities;
|
||||
using Bit.Core.AdminConsole.Enums;
|
||||
|
||||
namespace Bit.Core.AdminConsole.OrganizationFeatures.Policies.PolicyRequirements;
|
||||
|
||||
/// <summary>
|
||||
/// An interface that defines how to create a single <see cref="IPolicyRequirement"/> from a Policy.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The <see cref="IPolicyRequirement"/> that the factory produces.</typeparam>
|
||||
public interface IOrganizationPolicyRequirementFactory<out T> where T : IPolicyRequirement
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="PolicyType"/> that the requirement relates to.
|
||||
/// </summary>
|
||||
PolicyType PolicyType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// A reducer method that creates a <see cref="IPolicyRequirement"/> from a Policy.
|
||||
/// </summary>
|
||||
/// <param name="policy">The policy for the specified PolicyType.</param>
|
||||
T Create(Policy? policy);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user