mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-21 16:18:28 +01:00
SM-716 - Write access for service accounts (#5622)
* SM-716 * thomas suggested changes * removing unused code * 2
This commit is contained in:
parent
05c4d172a7
commit
b845eaf91f
@ -11,6 +11,7 @@
|
||||
[emptyMessage]="'projectEmptyServiceAccountAccessPolicies' | i18n"
|
||||
(onCreateAccessPolicies)="handleCreateAccessPolicies($event)"
|
||||
(onDeleteAccessPolicy)="handleDeleteAccessPolicy($event)"
|
||||
(onUpdateAccessPolicy)="handleUpdateAccessPolicy($event)"
|
||||
>
|
||||
</sm-access-selector>
|
||||
</div>
|
||||
|
@ -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
|
||||
|
@ -11,6 +11,7 @@
|
||||
[emptyMessage]="'serviceAccountEmptyProjectAccesspolicies' | i18n"
|
||||
(onCreateAccessPolicies)="handleCreateAccessPolicies($event)"
|
||||
(onDeleteAccessPolicy)="handleDeleteAccessPolicy($event)"
|
||||
(onUpdateAccessPolicy)="handleUpdateAccessPolicy($event)"
|
||||
>
|
||||
</sm-access-selector>
|
||||
</div>
|
||||
|
@ -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<void>();
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user