-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into PM-13783-API-Battle-harden-the-ProviderType-…
…enum-expansion
- Loading branch information
Showing
61 changed files
with
10,439 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/Api/AdminConsole/Models/Response/Helpers/PolicyDetailResponses.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using Bit.Api.AdminConsole.Models.Response.Organizations; | ||
using Bit.Core.AdminConsole.Entities; | ||
using Bit.Core.AdminConsole.Enums; | ||
using Bit.Core.AdminConsole.OrganizationFeatures.OrganizationDomains.Interfaces; | ||
|
||
namespace Bit.Api.AdminConsole.Models.Response.Helpers; | ||
|
||
public static class PolicyDetailResponses | ||
{ | ||
public static async Task<PolicyDetailResponseModel> GetSingleOrgPolicyDetailResponseAsync(this Policy policy, IOrganizationHasVerifiedDomainsQuery hasVerifiedDomainsQuery) | ||
{ | ||
if (policy.Type is not PolicyType.SingleOrg) | ||
{ | ||
throw new ArgumentException($"'{nameof(policy)}' must be of type '{nameof(PolicyType.SingleOrg)}'.", nameof(policy)); | ||
} | ||
|
||
return new PolicyDetailResponseModel(policy, !await hasVerifiedDomainsQuery.HasVerifiedDomainsAsync(policy.OrganizationId)); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/Api/AdminConsole/Models/Response/Organizations/PolicyDetailResponseModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Bit.Core.AdminConsole.Entities; | ||
|
||
namespace Bit.Api.AdminConsole.Models.Response.Organizations; | ||
|
||
public class PolicyDetailResponseModel : PolicyResponseModel | ||
{ | ||
public PolicyDetailResponseModel(Policy policy, string obj = "policy") : base(policy, obj) | ||
{ | ||
} | ||
|
||
public PolicyDetailResponseModel(Policy policy, bool canToggleState) : base(policy) | ||
{ | ||
CanToggleState = canToggleState; | ||
} | ||
|
||
/// <summary> | ||
/// Indicates whether the Policy can be enabled/disabled | ||
/// </summary> | ||
public bool CanToggleState { get; set; } = true; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.