From ace524c8c7a1a7cb8211143f64226d76052647c4 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Wed, 22 May 2024 08:05:48 -0400
Subject: [PATCH 1/4] [deps] Platform: Update @types/jquery to v3.5.30 (#9148)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
---
package-lock.json | 8 ++++----
package.json | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 08365b8200f..ccb7bd8ba78 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -99,7 +99,7 @@
"@types/firefox-webext-browser": "111.0.5",
"@types/inquirer": "8.2.10",
"@types/jest": "29.5.12",
- "@types/jquery": "3.5.29",
+ "@types/jquery": "3.5.30",
"@types/jsdom": "21.1.6",
"@types/koa": "2.14.0",
"@types/koa__multer": "2.0.7",
@@ -10340,9 +10340,9 @@
"dev": true
},
"node_modules/@types/jquery": {
- "version": "3.5.29",
- "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.29.tgz",
- "integrity": "sha512-oXQQC9X9MOPRrMhPHHOsXqeQDnWeCDT3PelUIg/Oy8FAbzSZtFHRjc7IpbfFVmpLtJ+UOoywpRsuO5Jxjybyeg==",
+ "version": "3.5.30",
+ "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.5.30.tgz",
+ "integrity": "sha512-nbWKkkyb919DOUxjmRVk8vwtDb0/k8FKncmUKFi+NY+QXqWltooxTrswvz4LspQwxvLdvzBN1TImr6cw3aQx2A==",
"dev": true,
"dependencies": {
"@types/sizzle": "*"
diff --git a/package.json b/package.json
index 45c2d73cb91..1850de265ea 100644
--- a/package.json
+++ b/package.json
@@ -60,7 +60,7 @@
"@types/firefox-webext-browser": "111.0.5",
"@types/inquirer": "8.2.10",
"@types/jest": "29.5.12",
- "@types/jquery": "3.5.29",
+ "@types/jquery": "3.5.30",
"@types/jsdom": "21.1.6",
"@types/koa": "2.14.0",
"@types/koa__multer": "2.0.7",
From 588663f80f53f7c74f33dd55dc8b16d562ee9a03 Mon Sep 17 00:00:00 2001
From: vinith-kovan <156108204+vinith-kovan@users.noreply.github.com>
Date: Wed, 22 May 2024 17:49:24 +0530
Subject: [PATCH 2/4] [PM 4983] migrate vault timeout input component (#8661)
* migrate vault timeout input component
* migrate vault timeout input component
---
.../vault-timeout-input.component.html | 68 +++++++------------
1 file changed, 25 insertions(+), 43 deletions(-)
diff --git a/apps/web/src/app/settings/vault-timeout-input.component.html b/apps/web/src/app/settings/vault-timeout-input.component.html
index 3791fa7e543..4911b1d57db 100644
--- a/apps/web/src/app/settings/vault-timeout-input.component.html
+++ b/apps/web/src/app/settings/vault-timeout-input.component.html
@@ -1,47 +1,29 @@
-
-
-
- {{
+
+ {{ "vaultTimeout" | i18n }}
+
+
+
+ {{
((canLockVault$ | async) ? "vaultTimeoutDesc" : "vaultTimeoutLogoutDesc") | i18n
- }}
-
-
From ca62f0cfa347f68bc281815372b79a9d9092cb91 Mon Sep 17 00:00:00 2001
From: vinith-kovan <156108204+vinith-kovan@users.noreply.github.com>
Date: Wed, 22 May 2024 18:04:48 +0530
Subject: [PATCH 3/4] [AC-2405] migrate SCIM component (#8781)
* migrating scim authentication component
* migrating scim authentication component
* migrating scim authentication component
---
.../organizations/manage/scim.component.html | 84 ++++++-------------
.../organizations/manage/scim.component.ts | 81 ++++++++----------
2 files changed, 60 insertions(+), 105 deletions(-)
diff --git a/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/scim.component.html b/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/scim.component.html
index 6724b4a0e01..e30883515e0 100644
--- a/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/scim.component.html
+++ b/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/scim.component.html
@@ -1,39 +1,21 @@
-
{{ "scimDescription" | i18n }}
+
{{ "scimDescription" | i18n }}
- {{ "loading" | i18n }}
+ {{ "loading" | i18n }}
-
diff --git a/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/scim.component.ts b/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/scim.component.ts
index 8e8db457e50..55ae318e982 100644
--- a/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/scim.component.ts
+++ b/bitwarden_license/bit-web/src/app/admin-console/organizations/manage/scim.component.ts
@@ -14,7 +14,6 @@ import { OrganizationApiKeyRequest } from "@bitwarden/common/admin-console/model
import { OrganizationConnectionRequest } from "@bitwarden/common/admin-console/models/request/organization-connection.request";
import { ScimConfigRequest } from "@bitwarden/common/admin-console/models/request/scim-config.request";
import { OrganizationConnectionResponse } from "@bitwarden/common/admin-console/models/response/organization-connection.response";
-import { ApiKeyResponse } from "@bitwarden/common/auth/models/response/api-key.response";
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
@@ -29,8 +28,6 @@ export class ScimComponent implements OnInit {
loading = true;
organizationId: string;
existingConnectionId: string;
- formPromise: Promise
>;
- rotatePromise: Promise;
enabled = new FormControl(false);
showScimSettings = false;
showScimKey = false;
@@ -82,11 +79,11 @@ export class ScimComponent implements OnInit {
});
}
- async copyScimUrl() {
+ copyScimUrl = async () => {
this.platformUtilsService.copyToClipboard(await this.getScimEndpointUrl());
- }
+ };
- async rotateScimKey() {
+ rotateScimKey = async () => {
const confirmed = await this.dialogService.openSimpleDialog({
title: { key: "rotateScimKey" },
content: { key: "rotateScimKeyWarning" },
@@ -102,62 +99,50 @@ export class ScimComponent implements OnInit {
request.type = OrganizationApiKeyType.Scim;
request.masterPasswordHash = "N/A";
- this.rotatePromise = this.organizationApiService.rotateApiKey(this.organizationId, request);
+ const response = await this.organizationApiService.rotateApiKey(this.organizationId, request);
+ this.formData.setValue({
+ endpointUrl: await this.getScimEndpointUrl(),
+ clientSecret: response.apiKey,
+ });
+ this.platformUtilsService.showToast("success", null, this.i18nService.t("scimApiKeyRotated"));
+ };
- try {
- const response = await this.rotatePromise;
- this.formData.setValue({
- endpointUrl: await this.getScimEndpointUrl(),
- clientSecret: response.apiKey,
- });
- this.platformUtilsService.showToast("success", null, this.i18nService.t("scimApiKeyRotated"));
- } catch {
- // Logged by appApiAction, do nothing
- }
-
- this.rotatePromise = null;
- }
-
- async copyScimKey() {
+ copyScimKey = async () => {
this.platformUtilsService.copyToClipboard(this.formData.get("clientSecret").value);
- }
+ };
- async submit() {
- try {
- const request = new OrganizationConnectionRequest(
- this.organizationId,
- OrganizationConnectionType.Scim,
- true,
- new ScimConfigRequest(this.enabled.value),
+ submit = async () => {
+ const request = new OrganizationConnectionRequest(
+ this.organizationId,
+ OrganizationConnectionType.Scim,
+ true,
+ new ScimConfigRequest(this.enabled.value),
+ );
+ let response: OrganizationConnectionResponse;
+
+ if (this.existingConnectionId == null) {
+ response = await this.apiService.createOrganizationConnection(request, ScimConfigApi);
+ } else {
+ response = await this.apiService.updateOrganizationConnection(
+ request,
+ ScimConfigApi,
+ this.existingConnectionId,
);
- if (this.existingConnectionId == null) {
- this.formPromise = this.apiService.createOrganizationConnection(request, ScimConfigApi);
- } else {
- this.formPromise = this.apiService.updateOrganizationConnection(
- request,
- ScimConfigApi,
- this.existingConnectionId,
- );
- }
- const response = (await this.formPromise) as OrganizationConnectionResponse;
- await this.setConnectionFormValues(response);
- this.platformUtilsService.showToast("success", null, this.i18nService.t("scimSettingsSaved"));
- } catch (e) {
- // Logged by appApiAction, do nothing
}
- this.formPromise = null;
- }
+ await this.setConnectionFormValues(response);
+ this.platformUtilsService.showToast("success", null, this.i18nService.t("scimSettingsSaved"));
+ };
async getScimEndpointUrl() {
const env = await firstValueFrom(this.environmentService.environment$);
return env.getScimUrl() + "/" + this.organizationId;
}
- toggleScimKey() {
+ toggleScimKey = () => {
this.showScimKey = !this.showScimKey;
document.getElementById("clientSecret").focus();
- }
+ };
private async setConnectionFormValues(connection: OrganizationConnectionResponse) {
this.existingConnectionId = connection?.id;
From a5bfff891bb2d5024cd7263a255fa062d4439ab3 Mon Sep 17 00:00:00 2001
From: vinith-kovan <156108204+vinith-kovan@users.noreply.github.com>
Date: Wed, 22 May 2024 18:50:06 +0530
Subject: [PATCH 4/4] migrate policy edit component (#8914)
---
.../policies/policies.component.ts | 36 ++++----
.../policies/policy-edit.component.html | 71 ++++++---------
.../policies/policy-edit.component.ts | 87 ++++++++++---------
3 files changed, 88 insertions(+), 106 deletions(-)
diff --git a/apps/web/src/app/admin-console/organizations/policies/policies.component.ts b/apps/web/src/app/admin-console/organizations/policies/policies.component.ts
index 6f8bb27671f..782db231c69 100644
--- a/apps/web/src/app/admin-console/organizations/policies/policies.component.ts
+++ b/apps/web/src/app/admin-console/organizations/policies/policies.component.ts
@@ -1,18 +1,19 @@
import { Component, OnInit, ViewChild, ViewContainerRef } from "@angular/core";
-import { ActivatedRoute, Router } from "@angular/router";
+import { ActivatedRoute } from "@angular/router";
+import { lastValueFrom } from "rxjs";
import { first } from "rxjs/operators";
-import { ModalService } from "@bitwarden/angular/services/modal.service";
import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { PolicyApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/policy/policy-api.service.abstraction";
import { PolicyType } from "@bitwarden/common/admin-console/enums";
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
import { PolicyResponse } from "@bitwarden/common/admin-console/models/response/policy.response";
+import { DialogService } from "@bitwarden/components";
import { PolicyListService } from "../../core/policy-list.service";
import { BasePolicy } from "../policies";
-import { PolicyEditComponent } from "./policy-edit.component";
+import { PolicyEditComponent, PolicyEditDialogResult } from "./policy-edit.component";
@Component({
selector: "app-org-policies",
@@ -33,11 +34,10 @@ export class PoliciesComponent implements OnInit {
constructor(
private route: ActivatedRoute,
- private modalService: ModalService,
private organizationService: OrganizationService,
private policyApiService: PolicyApiServiceAbstraction,
private policyListService: PolicyListService,
- private router: Router,
+ private dialogService: DialogService,
) {}
async ngOnInit() {
@@ -83,21 +83,17 @@ export class PoliciesComponent implements OnInit {
}
async edit(policy: BasePolicy) {
- const [modal] = await this.modalService.openViewRef(
- PolicyEditComponent,
- this.editModalRef,
- (comp) => {
- comp.policy = policy;
- comp.organizationId = this.organizationId;
- comp.policiesEnabledMap = this.policiesEnabledMap;
- // eslint-disable-next-line rxjs-angular/prefer-takeuntil
- comp.onSavedPolicy.subscribe(() => {
- modal.close();
- // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
- // eslint-disable-next-line @typescript-eslint/no-floating-promises
- this.load();
- });
+ const dialogRef = PolicyEditComponent.open(this.dialogService, {
+ data: {
+ policy: policy,
+ organizationId: this.organizationId,
+ policiesEnabledMap: this.policiesEnabledMap,
},
- );
+ });
+
+ const result = await lastValueFrom(dialogRef.closed);
+ if (result === PolicyEditDialogResult.Saved) {
+ await this.load();
+ }
}
}
diff --git a/apps/web/src/app/admin-console/organizations/policies/policy-edit.component.html b/apps/web/src/app/admin-console/organizations/policies/policy-edit.component.html
index 5f5dc1d85ef..063a8759e6f 100644
--- a/apps/web/src/app/admin-console/organizations/policies/policy-edit.component.html
+++ b/apps/web/src/app/admin-console/organizations/policies/policy-edit.component.html
@@ -1,49 +1,28 @@
-