1
0
mirror of https://github.com/bitwarden/server.git synced 2025-01-06 19:28:08 +01:00

Add default interface implementation

This commit is contained in:
Thomas Rittson 2024-10-07 10:52:43 +10:00
parent 71629047ad
commit 22500e4222
No known key found for this signature in database
GPG Key ID: CDDDA03861C35E27
2 changed files with 2 additions and 12 deletions

View File

@ -25,7 +25,7 @@ public interface IPolicyDefinition
/// <param name="currentPolicy">The current policy, if any</param>
/// <param name="modifiedPolicy">The modified policy to be saved</param>
/// <returns>A sequence of validation errors if validation was unsuccessful</returns>
public Task<string?> ValidateAsync(Policy? currentPolicy, Policy modifiedPolicy);
public Task<string?> ValidateAsync(Policy? currentPolicy, Policy modifiedPolicy) => Task.FromResult<string?>(null);
/// <summary>
/// Optionally performs side effects after a policy is validated but before it is saved.
@ -33,5 +33,5 @@ public interface IPolicyDefinition
/// </summary>
/// <param name="currentPolicy">The current policy, if any</param>
/// <param name="modifiedPolicy">The modified policy to be saved</param>
public Task OnSaveSideEffectsAsync(Policy? currentPolicy, Policy modifiedPolicy);
public Task OnSaveSideEffectsAsync(Policy? currentPolicy, Policy modifiedPolicy) => Task.FromResult(0);
}

View File

@ -30,14 +30,4 @@ public class FakeRequireSsoPolicyDefinition : IPolicyDefinition
{
public PolicyType Type => PolicyType.RequireSso;
public IEnumerable<PolicyType> RequiredPolicies => [PolicyType.SingleOrg];
public Task<string?> ValidateAsync(Policy? currentPolicy, Policy modifiedPolicy)
{
return Task.FromResult((string)null);
}
public Task OnSaveSideEffectsAsync(Policy? currentPolicy, Policy modifiedPolicy)
{
return Task.FromResult(0);
}
}