1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-12-22 16:29:09 +01:00

[EC-1003] Make External ID in group modal to read-only (#4492)

* [EC-1003] chore: refactor form builder

* [EC-1003] feat: disable externalId

* [EC-1003] feat: disable `externalId` editing

* [EC-1003] feat: remove `externalId` from request classes
This commit is contained in:
Andreas Coroiu 2023-02-06 10:27:47 +01:00 committed by GitHub
parent 8675219162
commit ff8f19aa2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 9 deletions

View File

@ -64,7 +64,6 @@ export class GroupService {
async save(group: GroupView): Promise<GroupView> {
const request = new GroupRequest();
request.name = group.name;
request.externalId = group.externalId;
request.accessAll = group.accessAll;
request.users = group.members;
request.collections = group.collections.map(

View File

@ -3,7 +3,6 @@ import { SelectionReadOnlyRequest } from "@bitwarden/common/models/request/selec
export class GroupRequest {
name: string;
accessAll: boolean;
externalId: string;
collections: SelectionReadOnlyRequest[] = [];
users: string[] = [];
}

View File

@ -1,6 +1,6 @@
import { DIALOG_DATA, DialogConfig, DialogRef } from "@angular/cdk/dialog";
import { ChangeDetectorRef, Component, Inject, OnDestroy, OnInit } from "@angular/core";
import { FormBuilder, FormControl, Validators } from "@angular/forms";
import { FormBuilder, Validators } from "@angular/forms";
import { catchError, combineLatest, from, map, of, Subject, switchMap, takeUntil } from "rxjs";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
@ -90,11 +90,11 @@ export class GroupAddEditComponent implements OnInit, OnDestroy {
group: GroupView;
groupForm = this.formBuilder.group({
accessAll: new FormControl(false),
name: new FormControl("", [Validators.required, Validators.maxLength(100)]),
externalId: new FormControl("", Validators.maxLength(300)),
members: new FormControl<AccessItemValue[]>([]),
collections: new FormControl<AccessItemValue[]>([]),
accessAll: [false],
name: ["", [Validators.required, Validators.maxLength(100)]],
externalId: this.formBuilder.control({ value: "", disabled: true }),
members: [[] as AccessItemValue[]],
collections: [[] as AccessItemValue[]],
});
get groupId(): string | undefined {
@ -246,7 +246,6 @@ export class GroupAddEditComponent implements OnInit, OnDestroy {
const formValue = this.groupForm.value;
groupView.name = formValue.name;
groupView.externalId = formValue.externalId;
groupView.accessAll = formValue.accessAll;
groupView.members = formValue.members?.map((m) => m.id) ?? [];