mirror of
https://github.com/bitwarden/browser
synced 2025-12-23 11:43:46 +00:00
[EC-331] User status terminology updates (revoked/restore) (#3135)
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user