Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SM-923] Add project service accounts access policies management endpoints #3993

Merged
merged 56 commits into from May 2, 2024

Conversation

Thomas-Avery
Copy link
Contributor

@Thomas-Avery Thomas-Avery commented Apr 15, 2024

Type of change

- [ ] Bug fix
- [X] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [ ] Other

Objective

The purpose of this change is to add new project service accounts access policies management endpoints to support the new client design.

Client PR bitwarden/clients#8789

Code changes

  • bitwarden_license/src/Commercial.Core/SecretsManager/AuthorizationHandlers/AccessPolicies/ProjectServiceAccountsAccessPoliciesAuthorizationHandler.cs:
    src/Core/SecretsManager/AuthorizationRequirements/ProjectServiceAccountsAccessPoliciesOperationRequirement.cs:
    Add authz handler for processing ProjectServiceAccountsAccessPoliciesUpdates.

  • bitwarden_license/src/Commercial.Core/SecretsManager/Commands/AccessPolicies/UpdateProjectServiceAccountsAccessPoliciesCommand.cs:
    src/Core/SecretsManager/Commands/AccessPolicies/Interfaces/IUpdateProjectServiceAccountsAccessPoliciesCommand.cs:
    Add command for executing ProjectServiceAccountsAccessPoliciesUpdates.

  • bitwarden_license/src/Commercial.Core/SecretsManager/Queries/AccessPolicies/ProjectServiceAccountsAccessPoliciesUpdatesQuery.cs:
    Add query to calculate what ProjectServiceAccountsAccessPoliciesUpdates need to be made.

  • bitwarden_license/src/Commercial.Core/SecretsManager/SecretsManagerCollectionExtensions.cs:
    Add new command, query, and authz handler to DI.

  • bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/AccessPolicyRepository.cs:
    src/Core/SecretsManager/Repositories/IAccessPolicyRepository.cs
    Add repository updates to handle ProjectServiceAccountsAccessPolicies.

  • bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ServiceAccountRepository.cs:
    src/Core/SecretsManager/Repositories/IServiceAccountRepository.cs:
    src/Core/SecretsManager/Repositories/Noop/NoopServiceAccountRepository.cs:
    Add repository methods to get access for many service accounts and check that all service accounts are in the same organization.

  • bitwarden_license/test/Commercial.Core.Test/SecretsManager/AuthorizationHandlers/AccessPolicies/ProjectServiceAccountsAccessPoliciesAuthorizationHandlerTests.cs:
    Add unit tests for the new authz handler.

  • bitwarden_license/test/Commercial.Core.Test/SecretsManager/Commands/AccessPolicies/UpdateProjectServiceAccountsAccessPoliciesCommandTests.cs:
    Add unit tests for the new command.

  • bitwarden_license/test/Commercial.Core.Test/SecretsManager/Queries/AccessPolicies/ProjectServiceAccountsAccessPoliciesUpdatesQueryTests.cs:
    src/Core/SecretsManager/Queries/AccessPolicies/Interfaces/IProjectServiceAccountsAccessPoliciesUpdatesQuery.cs:
    Add unit tests for the new query.

  • src/Api/SecretsManager/Controllers/AccessPoliciesController.cs:
    Add new management endpoints.

  • src/Api/SecretsManager/Models/Request/ProjectServiceAccountsAccessPoliciesRequestModel.cs:
    Add request model for new management endpoints.

  • src/Api/SecretsManager/Models/Response/ProjectServiceAccountsAccessPoliciesResponseModel.cs:
    Add response model for new management endpoints.

  • src/Api/SecretsManager/Models/Response/ProjectServiceAccountsAccessPoliciesResponseModel.cs:
    Add response model for new management endpoints.

  • src/Core/SecretsManager/Models/Data/AccessPolicyUpdates/ProjectServiceAccountsAccessPoliciesUpdates.cs:
    Add data model to represent updates to a project's service accounts access policies.

  • src/Core/SecretsManager/Models/Data/ProjectServiceAccountsAccessPolicies.cs:
    Add data model to represent a project's service accounts access policies.

  • test/Api.IntegrationTest/SecretsManager/Controllers/AccessPoliciesControllerTests.cs:
    Add integration tests for the new management endpoints.

  • test/Api.Test/SecretsManager/Controllers/AccessPoliciesControllerTests.cs:
    Add unit tests for the new management endpoints.

  • test/Core.Test/SecretsManager/Models/ProjectServiceAccountsAccessPoliciesTests.cs:
    Add unit tests for the data models methods.

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • If making database changes - make sure you also update Entity Framework queries and/or migrations
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team

@Thomas-Avery Thomas-Avery self-assigned this Apr 15, 2024
cd-bitwarden
cd-bitwarden previously approved these changes Apr 24, 2024
Copy link
Contributor

@cd-bitwarden cd-bitwarden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 👍 🎉

Base automatically changed from sm/sm-910 to main May 1, 2024 16:47
@Thomas-Avery Thomas-Avery dismissed cd-bitwarden’s stale review May 1, 2024 16:47

The base branch was changed.

Copy link
Contributor

@cd-bitwarden cd-bitwarden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your most recent changes look good!

@Thomas-Avery Thomas-Avery merged commit 7f8cea5 into main May 2, 2024
49 checks passed
@Thomas-Avery Thomas-Avery deleted the sm/sm-923 branch May 2, 2024 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants