diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-service-accounts.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-service-accounts.component.html index fb6eab471b..2755377d2a 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-service-accounts.component.html +++ b/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-service-accounts.component.html @@ -11,6 +11,7 @@ [emptyMessage]="'projectEmptyServiceAccountAccessPolicies' | i18n" (onCreateAccessPolicies)="handleCreateAccessPolicies($event)" (onDeleteAccessPolicy)="handleDeleteAccessPolicy($event)" + (onUpdateAccessPolicy)="handleUpdateAccessPolicy($event)" > diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-service-accounts.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-service-accounts.component.ts index d64aec5f31..2cd2134dd4 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-service-accounts.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/projects/project/project-service-accounts.component.ts @@ -39,11 +39,21 @@ export class ProjectServiceAccountsComponent implements OnInit, OnDestroy { read: policy.read, write: policy.write, icon: AccessSelectorComponent.serviceAccountIcon, - static: true, + static: false, })) ) ); + protected async handleUpdateAccessPolicy(policy: AccessSelectorRowView) { + try { + return await this.accessPolicyService.updateAccessPolicy( + AccessSelectorComponent.getBaseAccessPolicyView(policy) + ); + } catch (e) { + this.validationService.showError(e); + } + } + protected handleCreateAccessPolicies(selected: SelectItemView[]) { const projectAccessPoliciesView = new ProjectAccessPoliciesView(); projectAccessPoliciesView.serviceAccountAccessPolicies = selected diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/projects/service-account-projects.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/projects/service-account-projects.component.html index 8ffc465e1b..368a62a933 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/projects/service-account-projects.component.html +++ b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/projects/service-account-projects.component.html @@ -11,6 +11,7 @@ [emptyMessage]="'serviceAccountEmptyProjectAccesspolicies' | i18n" (onCreateAccessPolicies)="handleCreateAccessPolicies($event)" (onDeleteAccessPolicy)="handleDeleteAccessPolicy($event)" + (onUpdateAccessPolicy)="handleUpdateAccessPolicy($event)" > diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/projects/service-account-projects.component.ts b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/projects/service-account-projects.component.ts index ecce07aef5..aed98a4235 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/projects/service-account-projects.component.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/projects/service-account-projects.component.ts @@ -1,4 +1,4 @@ -import { Component } from "@angular/core"; +import { Component, OnDestroy, OnInit } from "@angular/core"; import { ActivatedRoute } from "@angular/router"; import { combineLatestWith, map, Observable, startWith, Subject, switchMap, takeUntil } from "rxjs"; @@ -16,7 +16,7 @@ import { selector: "sm-service-account-projects", templateUrl: "./service-account-projects.component.html", }) -export class ServiceAccountProjectsComponent { +export class ServiceAccountProjectsComponent implements OnInit, OnDestroy { private destroy$ = new Subject(); private serviceAccountId: string; private organizationId: string; @@ -38,7 +38,7 @@ export class ServiceAccountProjectsComponent { read: policy.read, write: policy.write, icon: AccessSelectorComponent.projectIcon, - static: true, + static: false, } as AccessSelectorRowView; }); }) @@ -63,6 +63,16 @@ export class ServiceAccountProjectsComponent { ); } + protected async handleUpdateAccessPolicy(policy: AccessSelectorRowView) { + try { + return await this.accessPolicyService.updateAccessPolicy( + AccessSelectorComponent.getBaseAccessPolicyView(policy) + ); + } catch (e) { + this.validationService.showError(e); + } + } + protected async handleDeleteAccessPolicy(policy: AccessSelectorRowView) { try { await this.accessPolicyService.deleteAccessPolicy(policy.accessPolicyId);