[AC-1593] Update Toast/refresh token when User adds SM to org (#6610)

* Update toast message for SM addition

* Refresh identity token after SM sub

* Thomas' feedback
This commit is contained in:
Alex Morask 2023-11-01 10:50:31 -04:00 committed by GitHub
parent 0c3b569d0e
commit 5c7121d881
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -1,6 +1,7 @@
import { Component, EventEmitter, Input, Output } from "@angular/core"; import { Component, EventEmitter, Input, Output } from "@angular/core";
import { FormBuilder } from "@angular/forms"; import { FormBuilder } from "@angular/forms";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction"; import { OrganizationApiServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization-api.service.abstraction";
import { InternalOrganizationServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { InternalOrganizationServiceAbstraction } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
import { OrganizationData } from "@bitwarden/common/admin-console/models/data/organization.data"; import { OrganizationData } from "@bitwarden/common/admin-console/models/data/organization.data";
@ -26,6 +27,7 @@ export class SecretsManagerSubscribeStandaloneComponent {
formGroup = secretsManagerSubscribeFormFactory(this.formBuilder); formGroup = secretsManagerSubscribeFormFactory(this.formBuilder);
constructor( constructor(
private apiService: ApiService,
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private platformUtilsService: PlatformUtilsService, private platformUtilsService: PlatformUtilsService,
private i18nService: I18nService, private i18nService: I18nService,
@ -52,7 +54,17 @@ export class SecretsManagerSubscribeStandaloneComponent {
}); });
await this.organizationService.upsert(organizationData); await this.organizationService.upsert(organizationData);
this.platformUtilsService.showToast("success", null, this.i18nService.t("subscriptionUpdated")); /*
Because subscribing to Secrets Manager automatically provides access to Secrets Manager for the
subscribing user, we need to refresh the identity token to account for their updated permissions.
*/
await this.apiService.refreshIdentityToken();
this.platformUtilsService.showToast(
"success",
null,
this.i18nService.t("subscribedToSecretsManager")
);
this.onSubscribe.emit(); this.onSubscribe.emit();
}; };

View File

@ -3464,6 +3464,9 @@
"subscriptionUpdated": { "subscriptionUpdated": {
"message": "Subscription updated" "message": "Subscription updated"
}, },
"subscribedToSecretsManager": {
"message": "Subscription updated. You now have access to Secrets Manager."
},
"additionalOptions": { "additionalOptions": {
"message": "Additional options" "message": "Additional options"
}, },