-
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 remote-tracking branch 'origin/PM-13447-Admin-Add-Multi-organiz…
…ation-Enterprises-option-to-provider-creation' into PM-13447-Admin-Add-Multi-organization-Enterprises-option-to-provider-creation
- Loading branch information
Showing
66 changed files
with
2,545 additions
and
305 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Ephemeral environment cleanup | ||
|
||
on: | ||
pull_request: | ||
types: [unlabeled] | ||
|
||
jobs: | ||
validate-pr: | ||
name: Validate PR | ||
runs-on: ubuntu-24.04 | ||
outputs: | ||
config-exists: ${{ steps.validate-config.outputs.config-exists }} | ||
steps: | ||
- name: Checkout PR | ||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1 | ||
|
||
- name: Validate config exists in path | ||
id: validate-config | ||
run: | | ||
if [[ -f "ephemeral-environments/$GITHUB_HEAD_REF.yaml" ]]; then | ||
echo "Ephemeral environment config found in path, continuing." | ||
echo "config-exists=true" >> $GITHUB_OUTPUT | ||
fi | ||
cleanup-config: | ||
name: Cleanup ephemeral environment | ||
runs-on: ubuntu-24.04 | ||
needs: validate-pr | ||
if: ${{ needs.validate-pr.outputs.config-exists }} | ||
steps: | ||
- name: Log in to Azure - CI subscription | ||
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0 | ||
with: | ||
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} | ||
|
||
- name: Retrieve GitHub PAT secrets | ||
id: retrieve-secret-pat | ||
uses: bitwarden/gh-actions/get-keyvault-secrets@main | ||
with: | ||
keyvault: "bitwarden-ci" | ||
secrets: "github-pat-bitwarden-devops-bot-repo-scope" | ||
|
||
- name: Trigger Ephemeral Environment cleanup | ||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | ||
with: | ||
github-token: ${{ steps.retrieve-secret-pat.outputs.github-pat-bitwarden-devops-bot-repo-scope }} | ||
script: | | ||
await github.rest.actions.createWorkflowDispatch({ | ||
owner: 'bitwarden', | ||
repo: 'devops', | ||
workflow_id: '_ephemeral_environment_pr_manager.yml', | ||
ref: 'main', | ||
inputs: { | ||
ephemeral_env_branch: process.env.GITHUB_HEAD_REF, | ||
cleanup_config: true, | ||
project: 'server' | ||
} | ||
}) |
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
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
43 changes: 43 additions & 0 deletions
43
src/Core/AdminConsole/OrganizationFeatures/Policies/IPolicyValidator.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,43 @@ | ||
#nullable enable | ||
|
||
using Bit.Core.AdminConsole.Entities; | ||
using Bit.Core.AdminConsole.Enums; | ||
using Bit.Core.AdminConsole.OrganizationFeatures.Policies.Models; | ||
|
||
namespace Bit.Core.AdminConsole.OrganizationFeatures.Policies; | ||
|
||
/// <summary> | ||
/// Defines behavior and functionality for a given PolicyType. | ||
/// </summary> | ||
public interface IPolicyValidator | ||
{ | ||
/// <summary> | ||
/// The PolicyType that this definition relates to. | ||
/// </summary> | ||
public PolicyType Type { get; } | ||
|
||
/// <summary> | ||
/// PolicyTypes that must be enabled before this policy can be enabled, if any. | ||
/// These dependencies will be checked when this policy is enabled and when any required policy is disabled. | ||
/// </summary> | ||
public IEnumerable<PolicyType> RequiredPolicies { get; } | ||
|
||
/// <summary> | ||
/// Validates a policy before saving it. | ||
/// Do not use this for simple dependencies between different policies - see <see cref="RequiredPolicies"/> instead. | ||
/// Implementation is optional; by default it will not perform any validation. | ||
/// </summary> | ||
/// <param name="policyUpdate">The policy update request</param> | ||
/// <param name="currentPolicy">The current policy, if any</param> | ||
/// <returns>A validation error if validation was unsuccessful, otherwise an empty string</returns> | ||
public Task<string> ValidateAsync(PolicyUpdate policyUpdate, Policy? currentPolicy); | ||
|
||
/// <summary> | ||
/// Performs side effects after a policy is validated but before it is saved. | ||
/// For example, this can be used to remove non-compliant users from the organization. | ||
/// Implementation is optional; by default it will not perform any side effects. | ||
/// </summary> | ||
/// <param name="policyUpdate">The policy update request</param> | ||
/// <param name="currentPolicy">The current policy, if any</param> | ||
public Task OnSaveSideEffectsAsync(PolicyUpdate policyUpdate, Policy? currentPolicy); | ||
} |
8 changes: 8 additions & 0 deletions
8
src/Core/AdminConsole/OrganizationFeatures/Policies/ISavePolicyCommand.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,8 @@ | ||
using Bit.Core.AdminConsole.OrganizationFeatures.Policies.Models; | ||
|
||
namespace Bit.Core.AdminConsole.OrganizationFeatures.Policies; | ||
|
||
public interface ISavePolicyCommand | ||
{ | ||
Task SaveAsync(PolicyUpdate policy); | ||
} |
Oops, something went wrong.