[EC-331] User status terminology updates (revoked/restore) (#3135)

This commit is contained in:
Thomas Rittson 2022-07-20 11:41:27 +10:00 committed by GitHub
parent f07e071f09
commit 00ac22ba01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 81 additions and 110 deletions

View File

@ -204,15 +204,18 @@ export abstract class BasePeopleComponent<
this.edit(null);
}
async remove(user: UserType) {
const confirmed = await this.platformUtilsService.showDialog(
this.deleteWarningMessage(user),
protected async removeUserConfirmationDialog(user: UserType) {
return this.platformUtilsService.showDialog(
this.i18nService.t("removeUserConfirmation"),
this.userNamePipe.transform(user),
this.i18nService.t("yes"),
this.i18nService.t("no"),
"warning"
);
}
async remove(user: UserType) {
const confirmed = await this.removeUserConfirmationDialog(user);
if (!confirmed) {
return false;
}
@ -235,8 +238,8 @@ export abstract class BasePeopleComponent<
async deactivate(user: UserType) {
const confirmed = await this.platformUtilsService.showDialog(
this.deactivateWarningMessage(),
this.i18nService.t("deactivateUserId", this.userNamePipe.transform(user)),
this.i18nService.t("deactivate"),
this.i18nService.t("revokeUserId", this.userNamePipe.transform(user)),
this.i18nService.t("revokeAccess"),
this.i18nService.t("cancel"),
"warning"
);
@ -251,7 +254,7 @@ export abstract class BasePeopleComponent<
this.platformUtilsService.showToast(
"success",
null,
this.i18nService.t("deactivatedUserId", this.userNamePipe.transform(user))
this.i18nService.t("revokedUserId", this.userNamePipe.transform(user))
);
await this.load();
} catch (e) {
@ -261,25 +264,13 @@ export abstract class BasePeopleComponent<
}
async activate(user: UserType) {
const confirmed = await this.platformUtilsService.showDialog(
this.activateWarningMessage(),
this.i18nService.t("activateUserId", this.userNamePipe.transform(user)),
this.i18nService.t("activate"),
this.i18nService.t("cancel"),
"warning"
);
if (!confirmed) {
return false;
}
this.actionPromise = this.activateUser(user.id);
try {
await this.actionPromise;
this.platformUtilsService.showToast(
"success",
null,
this.i18nService.t("activatedUserId", this.userNamePipe.transform(user))
this.i18nService.t("restoredUserId", this.userNamePipe.transform(user))
);
await this.load();
} catch (e) {
@ -395,7 +386,7 @@ export abstract class BasePeopleComponent<
}
protected deactivateWarningMessage(): string {
return this.i18nService.t("deactivateUserConfirmation");
return this.i18nService.t("revokeUserConfirmation");
}
protected activateWarningMessage(): string {

View File

@ -22,8 +22,8 @@
{{ error }}
</app-callout>
<ng-container *ngIf="!done">
<app-callout type="warning" *ngIf="users.length > 0 && !error">
{{ usersWarning }}
<app-callout type="warning" *ngIf="users.length > 0 && !error && isDeactivating">
{{ "revokeUsersWarning" | i18n }}
</app-callout>
<table class="table table-hover table-list">
<thead>

View File

@ -1,6 +1,5 @@
import { Component } from "@angular/core";
import { ModalRef } from "@bitwarden/angular/components/modal/modal.ref";
import { ModalConfig } from "@bitwarden/angular/services/modal.service";
import { ApiService } from "@bitwarden/common/abstractions/api.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
@ -26,7 +25,6 @@ export class BulkDeactivateComponent {
constructor(
protected apiService: ApiService,
protected i18nService: I18nService,
private modalRef: ModalRef,
config: ModalConfig
) {
this.isDeactivating = config.data.isDeactivating;
@ -35,21 +33,16 @@ export class BulkDeactivateComponent {
}
get bulkTitle() {
const titleKey = this.isDeactivating ? "deactivateUsers" : "activateUsers";
const titleKey = this.isDeactivating ? "revokeUsers" : "restoreUsers";
return this.i18nService.t(titleKey);
}
get usersWarning() {
const warningKey = this.isDeactivating ? "deactivateUsersWarning" : "activateUsersWarning";
return this.i18nService.t(warningKey);
}
async submit() {
this.loading = true;
try {
const response = await this.performBulkUserAction();
const bulkMessage = this.isDeactivating ? "bulkDeactivatedMessage" : "bulkActivatedMessage";
const bulkMessage = this.isDeactivating ? "bulkRevokedMessage" : "bulkRestoredMessage";
response.data.forEach((entry) => {
const error = entry.error !== "" ? entry.error : this.i18nService.t(bulkMessage);
this.statuses.set(entry.id, error);
@ -60,7 +53,6 @@ export class BulkDeactivateComponent {
}
this.loading = false;
this.modalRef.close();
}
protected async performBulkUserAction() {

View File

@ -23,7 +23,7 @@
</app-callout>
<ng-container *ngIf="!done">
<app-callout type="warning" *ngIf="users.length > 0 && !error">
{{ "removeUsersWarning" | i18n }}
{{ removeUsersWarning }}
</app-callout>
<table class="table table-hover table-list">
<thead>

View File

@ -43,4 +43,8 @@ export class BulkRemoveComponent {
const request = new OrganizationUserBulkRequest(this.users.map((user) => user.id));
return await this.apiService.deleteManyOrganizationUsers(this.organizationId, request);
}
protected get removeUsersWarning() {
return this.i18nService.t("removeOrgUsersConfirmation");
}
}

View File

@ -35,7 +35,7 @@
[ngClass]="{ active: status == userStatusType.Deactivated }"
(click)="filter(userStatusType.Deactivated)"
>
{{ "deactivated" | i18n }}
{{ "revoked" | i18n }}
<span bitBadge badgeType="info" *ngIf="deactivatedCount">{{ deactivatedCount }}</span>
</button>
</div>
@ -77,11 +77,11 @@
</button>
<button class="dropdown-item" appStopClick (click)="bulkActivate()">
<i class="bwi bwi-fw bwi-plus-circle" aria-hidden="true"></i>
{{ "activate" | i18n }}
{{ "restoreAccess" | i18n }}
</button>
<button class="dropdown-item" appStopClick (click)="bulkDeactivate()">
<i class="bwi bwi-fw bwi-minus-circle" aria-hidden="true"></i>
{{ "deactivate" | i18n }}
{{ "revokeAccess" | i18n }}
</button>
<button class="dropdown-item text-danger" appStopClick (click)="bulkRemove()">
<i class="bwi bwi-fw bwi-close" aria-hidden="true"></i>
@ -159,7 +159,7 @@
"accepted" | i18n
}}</span>
<span bitBadge badgeType="secondary" *ngIf="u.status === userStatusType.Deactivated">{{
"deactivated" | i18n
"revoked" | i18n
}}</span>
<small class="text-muted d-block" *ngIf="u.name">{{ u.name }}</small>
</td>
@ -259,7 +259,7 @@
*ngIf="u.status === userStatusType.Deactivated"
>
<i class="bwi bwi-fw bwi-plus-circle" aria-hidden="true"></i>
{{ "activate" | i18n }}
{{ "restoreAccess" | i18n }}
</a>
<a
class="dropdown-item"
@ -269,7 +269,7 @@
*ngIf="u.status !== userStatusType.Deactivated"
>
<i class="bwi bwi-fw bwi-minus-circle" aria-hidden="true"></i>
{{ "deactivate" | i18n }}
{{ "revokeAccess" | i18n }}
</a>
<a class="dropdown-item text-danger" href="#" appStopClick (click)="remove(u)">
<i class="bwi bwi-fw bwi-close" aria-hidden="true"></i>

View File

@ -397,12 +397,18 @@ export class PeopleComponent
);
}
protected deleteWarningMessage(user: OrganizationUserUserDetailsResponse): string {
if (user.usesKeyConnector) {
return this.i18nService.t("removeUserConfirmationKeyConnector");
}
protected async removeUserConfirmationDialog(user: OrganizationUserUserDetailsResponse) {
const warningMessage = user.usesKeyConnector
? this.i18nService.t("removeUserConfirmationKeyConnector")
: this.i18nService.t("removeOrgUserConfirmation");
return super.deleteWarningMessage(user);
return this.platformUtilsService.showDialog(
warningMessage,
this.i18nService.t("removeUserIdAccess", this.userNamePipe.transform(user)),
this.i18nService.t("yes"),
this.i18nService.t("no"),
"warning"
);
}
private async showBulkStatus(

View File

@ -11,9 +11,7 @@
<h2 class="modal-title" id="userAddEditTitle">
{{ title }}
<small class="text-muted" *ngIf="name">{{ name }}</small>
<span bitBadge badgeType="secondary" *ngIf="isDeactivated">{{
"deactivated" | i18n
}}</span>
<span bitBadge badgeType="secondary" *ngIf="isDeactivated">{{ "revoked" | i18n }}</span>
</h2>
<button
type="button"
@ -385,41 +383,31 @@
type="button"
(click)="activate()"
class="btn btn-outline-secondary"
appA11yTitle="{{ 'activate' | i18n }}"
*ngIf="editMode && isDeactivated"
[disabled]="form.loading"
>
<i
class="bwi bwi-plus-circle bwi-lg bwi-fw"
[hidden]="form.loading"
aria-hidden="true"
></i>
<i
class="bwi bwi-spinner bwi-spin bwi-lg bwi-fw"
[hidden]="!form.loading"
title="{{ 'loading' | i18n }}"
aria-hidden="true"
></i>
<span>{{ "restoreAccess" | i18n }}</span>
</button>
<button
type="button"
(click)="deactivate()"
class="btn btn-outline-secondary"
appA11yTitle="{{ 'deactivate' | i18n }}"
*ngIf="editMode && !isDeactivated"
[disabled]="form.loading"
>
<i
class="bwi bwi-minus-circle bwi-lg bwi-fw"
[hidden]="form.loading"
aria-hidden="true"
></i>
<i
class="bwi bwi-spinner bwi-spin bwi-lg bwi-fw"
[hidden]="!form.loading"
title="{{ 'loading' | i18n }}"
aria-hidden="true"
></i>
<span>{{ "revokeAccess" | i18n }}</span>
</button>
<button
#deleteBtn

View File

@ -216,10 +216,10 @@ export class UserAddEditComponent implements OnInit {
const message = this.usesKeyConnector
? "removeUserConfirmationKeyConnector"
: "removeUserConfirmation";
: "removeOrgUserConfirmation";
const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t(message),
this.name,
this.i18nService.t("removeUserIdAccess", this.name),
this.i18nService.t("yes"),
this.i18nService.t("no"),
"warning"
@ -251,9 +251,9 @@ export class UserAddEditComponent implements OnInit {
}
const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t("deactivateUserConfirmation"),
this.i18nService.t("deactivateUserId", this.name),
this.i18nService.t("deactivate"),
this.i18nService.t("revokeUserConfirmation"),
this.i18nService.t("revokeUserId", this.name),
this.i18nService.t("revokeAccess"),
this.i18nService.t("cancel"),
"warning"
);
@ -270,7 +270,7 @@ export class UserAddEditComponent implements OnInit {
this.platformUtilsService.showToast(
"success",
null,
this.i18nService.t("deactivatedUserId", this.name)
this.i18nService.t("revokedUserId", this.name)
);
this.isDeactivated = true;
this.onDeactivatedUser.emit();
@ -284,17 +284,6 @@ export class UserAddEditComponent implements OnInit {
return;
}
const confirmed = await this.platformUtilsService.showDialog(
this.i18nService.t("activateUserConfirmation"),
this.i18nService.t("activateUserId", this.name),
this.i18nService.t("activate"),
this.i18nService.t("cancel"),
"warning"
);
if (!confirmed) {
return false;
}
try {
this.formPromise = this.apiService.activateOrganizationUser(
this.organizationId,
@ -304,7 +293,7 @@ export class UserAddEditComponent implements OnInit {
this.platformUtilsService.showToast(
"success",
null,
this.i18nService.t("activatedUserId", this.name)
this.i18nService.t("restoredUserId", this.name)
);
this.isDeactivated = false;
this.onActivatedUser.emit();

View File

@ -1250,8 +1250,8 @@
"enabled": {
"message": "Enabled"
},
"activate": {
"message": "Activate"
"restoreAccess": {
"message": "Restore Access"
},
"premium": {
"message": "Premium",
@ -1278,8 +1278,8 @@
"disable": {
"message": "Disable"
},
"deactivate": {
"message": "Deactivate"
"revokeAccess": {
"message": "Revoke Access"
},
"twoStepLoginProviderEnabled": {
"message": "This two-step login provider is enabled on your account."
@ -2259,11 +2259,11 @@
"removeUserConfirmation": {
"message": "Are you sure you want to remove this user?"
},
"deactivateUserConfirmation": {
"message": "The member will no longer have access to the organization, but will still have access to their individual vault."
"removeOrgUserConfirmation": {
"message": "When a member is removed, they no longer have access to organization data and this action is irreversible. To add the member back to the organization, they must be invited and onboarded again."
},
"activateUserConfirmation": {
"message": "Are you sure you want to activate this user, granting them access to the organization?"
"revokeUserConfirmation": {
"message": "When a member is revoked, they no longer have access to organization data. To quickly restore member access, go to the Revoked tab."
},
"removeUserConfirmationKeyConnector": {
"message": "Warning! This user requires Key Connector to manage their encryption. Removing this user from your organization will permanently disable their account. This action cannot be undone. Do you want to proceed?"
@ -2610,8 +2610,8 @@
}
}
},
"deactivatedUserId": {
"message": "Deactivated user $ID$.",
"removeUserIdAccess": {
"message": "Remove $ID$ access",
"placeholders": {
"id": {
"content": "$1",
@ -2619,8 +2619,8 @@
}
}
},
"activatedUserId": {
"message": "Activated user $ID$.",
"revokedUserId": {
"message": "Revoked organization access for $ID$.",
"placeholders": {
"id": {
"content": "$1",
@ -2628,8 +2628,8 @@
}
}
},
"deactivateUserId": {
"message": "Deactivate user $ID$?",
"restoredUserId": {
"message": "Restored organization access for $ID$.",
"placeholders": {
"id": {
"content": "$1",
@ -2637,8 +2637,8 @@
}
}
},
"activateUserId": {
"message": "Activate user $ID$?",
"revokeUserId": {
"message": "Revoke $ID$ access",
"placeholders": {
"id": {
"content": "$1",
@ -3702,8 +3702,8 @@
"disabled": {
"message": "Disabled"
},
"deactivated": {
"message": "Deactivated"
"revoked": {
"message": "Revoked"
},
"sendLink": {
"message": "Send link",
@ -4306,11 +4306,11 @@
"removeUsersWarning": {
"message": "Are you sure you want to remove the following users? The process may take a few seconds to complete and cannot be interrupted or canceled."
},
"deactivateUsersWarning": {
"message": "Are you sure you want to deactivate the following members? They will no longer have access to the organization, but will still have access to their individual vaults. The process may take a few seconds to complete and cannot be interrupted or canceled."
"removeOrgUsersConfirmation": {
"message": "When member(s) are removed, they no longer have access to organization data and this action is irreversible. To add the member back to the organization, they must be invited and onboarded again. The process may take a few seconds to complete and cannot be interrupted or canceled."
},
"activateUsersWarning": {
"message": "Are you sure you want to activate the following members, granting them access to the organization? The process may take a few seconds to complete and cannot be interrupted or canceled."
"revokeUsersWarning": {
"message": "When member(s) are revoked, they no longer have access to organization data. To quickly restore member access, go to the Revoked tab. The process may take a few seconds to complete and cannot be interrupted or canceled."
},
"theme": {
"message": "Theme"
@ -4342,11 +4342,11 @@
"bulkRemovedMessage": {
"message": "Removed successfully"
},
"bulkDeactivatedMessage": {
"message": "Deactivated successfully"
"bulkRevokedMessage": {
"message": "Revoked organization access successfully"
},
"bulkActivatedMessage": {
"message": "Activated successfully"
"bulkRestoredMessage": {
"message": "Restored organization access successfully"
},
"bulkFilteredMessage": {
"message": "Excluded, not applicable for this action."
@ -4357,11 +4357,11 @@
"removeUsers": {
"message": "Remove Users"
},
"deactivateUsers": {
"message": "Deactivate Users"
"revokeUsers": {
"message": "Revoke Users"
},
"activateUsers": {
"message": "Activate Users"
"restoreUsers": {
"message": "Restore Users"
},
"error": {
"message": "Error"
@ -4773,9 +4773,6 @@
"sponsorshipCreated": {
"message": "Sponsorship Created"
},
"revoke": {
"message": "Revoke"
},
"emailSent": {
"message": "Email Sent"
},

View File

@ -15,4 +15,8 @@ export class BulkRemoveComponent extends OrganizationBulkRemoveComponent {
const request = new ProviderUserBulkRequest(this.users.map((user) => user.id));
return await this.apiService.deleteManyProviderUsers(this.providerId, request);
}
protected get removeUsersWarning() {
return this.i18nService.t("removeUsersWarning");
}
}