[SM-495] Access Policies - Individual Service Account - Project Tab #2697
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of change
Objective
The purpose of this PR is to create endpoints required to support the individual service account - projects tab for secrets manager.
Code changes
bitwarden_license/test/Commercial.Core.Test/SecretsManager/AccessPolicies/CreateAccessPoliciesCommandTests.cs
src/Core/SecretsManager/Commands/AccessPolicies/Interfaces/ICreateAccessPoliciesCommand.cs
Refactor to just one public method to support new endpoints.
src/Core/SecretsManager/Repositories/IAccessPolicyRepository.cs
New method for fetch access policies by the service account grantee.
Add in three new methods and some refactoring.
[HttpGet("/service-accounts/{id}/granted-policies")]
Fetch access policies where the service account is the grantee
[HttpPost("/service-accounts/{id}/granted-policies")]
Create access policies where the service account is the grantee
[HttpGet("/organizations/{id}/access-policies/projects/potential-grantees")]
Fetch projects that could potentially be used in access policy creation.
New request model for creation endpoint.
Add granted project name for responses.
Add projects as a potential target
bitwarden_license/src/Commercial.Infrastructure.EntityFramework/SecretsManager/Repositories/ProjectRepository.cs
New method for fetching projects that the user has write permissions to.
test/Api.IntegrationTest/SecretsManager/Controllers/AccessPoliciesControllerTest.cs
bitwarden_license/test/Commercial.Core.Test/SecretsManager/AccessPolicies/CreateAccessPoliciesCommandTests.cs
Update tests
Before you submit
dotnet format --verify-no-changes
) (required)