1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +00:00

[PM-18524] Make the External ID in the Collection dialog conditional (#14096)

* [PM-18524] Make the external ID in the collection dialog conditional

* [PM-18524] Update external ID in collection dialog to always be disabled

* [PM-18524] Display ExternalID field only in Admin Console

- Add isAdminConsoleActive flag to CollectionDialogParams
- Update isExternalIdVisible$ observable to respect context
- Set flag when dialog is opened from Admin Console routes

* [PM-18524] Enable/disable External ID field based on feature flag
This commit is contained in:
Rui Tomé
2025-04-03 14:13:47 +01:00
committed by GitHub
parent e697f73fd5
commit 960b77ddd7
3 changed files with 26 additions and 2 deletions

View File

@@ -1226,6 +1226,7 @@ export class VaultComponent implements OnInit, OnDestroy {
organizationId: this.organization?.id,
parentCollectionId: this.selectedCollection?.node.id,
limitNestedCollections: !this.organization.canEditAnyCollection,
isAdminConsoleActive: true,
},
});
@@ -1251,6 +1252,7 @@ export class VaultComponent implements OnInit, OnDestroy {
readonly: readonly,
isAddAccessCollection: c.unmanaged,
limitNestedCollections: !this.organization.canEditAnyCollection,
isAdminConsoleActive: true,
},
});

View File

@@ -35,7 +35,7 @@
</bit-select>
</bit-form-field>
<bit-form-field>
<bit-form-field *ngIf="isExternalIdVisible$ | async">
<bit-label>{{ "externalId" | i18n }}</bit-label>
<input bitInput formControlName="externalId" />
<bit-hint>{{ "externalIdDesc" | i18n }}</bit-hint>

View File

@@ -95,6 +95,7 @@ export interface CollectionDialogParams {
limitNestedCollections?: boolean;
readonly?: boolean;
isAddAccessCollection?: boolean;
isAdminConsoleActive?: boolean;
}
export interface CollectionDialogResult {
@@ -138,6 +139,16 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
protected showAddAccessWarning = false;
protected collections: Collection[];
protected buttonDisplayName: ButtonType = ButtonType.Save;
protected isExternalIdVisible$ = this.configService
.getFeatureFlag$(FeatureFlag.SsoExternalIdVisibility)
.pipe(
map((isEnabled) => {
return (
!isEnabled ||
(!!this.params.isAdminConsoleActive && !!this.formGroup.get("externalId")?.value)
);
}),
);
private orgExceedingCollectionLimit!: Organization;
constructor(
@@ -478,7 +489,18 @@ export class CollectionDialogComponent implements OnInit, OnDestroy {
this.formGroup.controls.access.disable();
} else {
this.formGroup.controls.name.enable();
this.formGroup.controls.externalId.enable();
this.configService
.getFeatureFlag$(FeatureFlag.SsoExternalIdVisibility)
.pipe(takeUntil(this.destroy$))
.subscribe((isEnabled) => {
if (isEnabled) {
this.formGroup.controls.externalId.disable();
} else {
this.formGroup.controls.externalId.enable();
}
});
this.formGroup.controls.parent.enable();
this.formGroup.controls.access.enable();
}