diff --git a/apps/web/src/app/admin-console/organizations/manage/entity-users.component.html b/apps/web/src/app/admin-console/organizations/manage/entity-users.component.html deleted file mode 100644 index e9296973a7..0000000000 --- a/apps/web/src/app/admin-console/organizations/manage/entity-users.component.html +++ /dev/null @@ -1,173 +0,0 @@ - diff --git a/apps/web/src/app/admin-console/organizations/manage/entity-users.component.ts b/apps/web/src/app/admin-console/organizations/manage/entity-users.component.ts deleted file mode 100644 index af0c344a29..0000000000 --- a/apps/web/src/app/admin-console/organizations/manage/entity-users.component.ts +++ /dev/null @@ -1,160 +0,0 @@ -import { Component, EventEmitter, Input, OnInit, Output } from "@angular/core"; - -import { SearchPipe } from "@bitwarden/angular/pipes/search.pipe"; -import { ApiService } from "@bitwarden/common/abstractions/api.service"; -import { OrganizationUserService } from "@bitwarden/common/abstractions/organization-user/organization-user.service"; -import { OrganizationUserUserDetailsResponse } from "@bitwarden/common/abstractions/organization-user/responses"; -import { - OrganizationUserStatusType, - OrganizationUserType, -} from "@bitwarden/common/admin-console/enums"; -import { SelectionReadOnlyRequest } from "@bitwarden/common/admin-console/models/request/selection-read-only.request"; -import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; -import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; -import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; -import { Utils } from "@bitwarden/common/platform/misc/utils"; - -@Component({ - selector: "app-entity-users", - templateUrl: "entity-users.component.html", - providers: [SearchPipe], -}) -export class EntityUsersComponent implements OnInit { - @Input() entity: "group" | "collection"; - @Input() entityId: string; - @Input() entityName: string; - @Input() organizationId: string; - @Output() onEditedUsers = new EventEmitter(); - - organizationUserType = OrganizationUserType; - organizationUserStatusType = OrganizationUserStatusType; - - showSelected = false; - loading = true; - formPromise: Promise; - selectedCount = 0; - searchText: string; - - private allUsers: OrganizationUserUserDetailsResponse[] = []; - - constructor( - private search: SearchPipe, - private apiService: ApiService, - private i18nService: I18nService, - private platformUtilsService: PlatformUtilsService, - private organizationUserService: OrganizationUserService, - private logService: LogService - ) {} - - async ngOnInit() { - await this.loadUsers(); - this.loading = false; - } - - get users() { - if (this.showSelected) { - return this.allUsers.filter((u) => (u as any).checked); - } else { - return this.allUsers; - } - } - - get searchedUsers() { - return this.search.transform(this.users, this.searchText, "name", "email", "id"); - } - - get scrollViewportStyle() { - return `min-height: 120px; height: ${120 + this.searchedUsers.length * 46}px`; - } - - async loadUsers() { - const users = await this.organizationUserService.getAllUsers(this.organizationId); - this.allUsers = users.data.map((r) => r).sort(Utils.getSortFunction(this.i18nService, "email")); - if (this.entity === "group") { - const response = await this.apiService.getGroupUsers(this.organizationId, this.entityId); - if (response != null && users.data.length > 0) { - response.forEach((s) => { - const user = users.data.filter((u) => u.id === s); - if (user != null && user.length > 0) { - (user[0] as any).checked = true; - } - }); - } - } else if (this.entity === "collection") { - const response = await this.apiService.getCollectionUsers(this.organizationId, this.entityId); - if (response != null && users.data.length > 0) { - response.forEach((s) => { - const user = users.data.filter((u) => !u.accessAll && u.id === s.id); - if (user != null && user.length > 0) { - (user[0] as any).checked = true; - (user[0] as any).readOnly = s.readOnly; - (user[0] as any).hidePasswords = s.hidePasswords; - } - }); - } - } - - this.allUsers.forEach((u) => { - if (this.entity === "collection" && u.accessAll) { - (u as any).checked = true; - } - if ((u as any).checked) { - this.selectedCount++; - } - }); - } - - check(u: OrganizationUserUserDetailsResponse) { - if (this.entity === "collection" && u.accessAll) { - return; - } - (u as any).checked = !(u as any).checked; - this.selectedChanged(u); - } - - selectedChanged(u: OrganizationUserUserDetailsResponse) { - if ((u as any).checked) { - this.selectedCount++; - } else { - if (this.entity === "collection") { - (u as any).readOnly = false; - (u as any).hidePasswords = false; - } - this.selectedCount--; - } - } - - filterSelected(showSelected: boolean) { - this.showSelected = showSelected; - } - - async submit() { - try { - if (this.entity === "group") { - const selections = this.users.filter((u) => (u as any).checked).map((u) => u.id); - this.formPromise = this.apiService.putGroupUsers( - this.organizationId, - this.entityId, - selections - ); - } else { - const selections = this.users - .filter((u) => (u as any).checked && !u.accessAll) - .map( - (u) => - new SelectionReadOnlyRequest(u.id, !!(u as any).readOnly, !!(u as any).hidePasswords) - ); - this.formPromise = this.apiService.putCollectionUsers( - this.organizationId, - this.entityId, - selections - ); - } - await this.formPromise; - this.platformUtilsService.showToast("success", null, this.i18nService.t("updatedUsers")); - this.onEditedUsers.emit(); - } catch (e) { - this.logService.error(e); - } - } -} diff --git a/apps/web/src/app/admin-console/organizations/manage/organization-manage.module.ts b/apps/web/src/app/admin-console/organizations/manage/organization-manage.module.ts deleted file mode 100644 index 9a7b166962..0000000000 --- a/apps/web/src/app/admin-console/organizations/manage/organization-manage.module.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ScrollingModule } from "@angular/cdk/scrolling"; -import { NgModule } from "@angular/core"; - -import { EntityUsersComponent } from "../../../admin-console/organizations/manage/entity-users.component"; -import { SharedModule } from "../../../shared"; - -@NgModule({ - imports: [SharedModule, ScrollingModule], - declarations: [EntityUsersComponent], - exports: [EntityUsersComponent], -}) -export class OrganizationManageModule {} diff --git a/apps/web/src/app/oss.module.ts b/apps/web/src/app/oss.module.ts index 1428aaea19..d15addba3e 100644 --- a/apps/web/src/app/oss.module.ts +++ b/apps/web/src/app/oss.module.ts @@ -1,7 +1,6 @@ import { NgModule } from "@angular/core"; import { OrganizationCreateModule } from "./admin-console/organizations/create/organization-create.module"; -import { OrganizationManageModule } from "./admin-console/organizations/manage/organization-manage.module"; import { OrganizationUserModule } from "./admin-console/organizations/users/organization-user.module"; import { LoginModule } from "./auth/login/login.module"; import { TrialInitiationModule } from "./auth/trial-initiation/trial-initiation.module"; @@ -16,7 +15,6 @@ import { VaultFilterModule } from "./vault/individual-vault/vault-filter/vault-f TrialInitiationModule, VaultFilterModule, OrganizationBadgeModule, - OrganizationManageModule, OrganizationUserModule, OrganizationCreateModule, LoginModule, diff --git a/apps/web/src/scss/styles.scss b/apps/web/src/scss/styles.scss index 2c0f9c21fd..05cd9fef4e 100644 --- a/apps/web/src/scss/styles.scss +++ b/apps/web/src/scss/styles.scss @@ -20,7 +20,7 @@ @import "~bootstrap/scss/_buttons"; @import "~bootstrap/scss/_transitions"; @import "~bootstrap/scss/_dropdown"; -@import "~bootstrap/scss/_button-group"; +// @import "~bootstrap/scss/_button-group"; @import "~bootstrap/scss/_input-group"; // @import "~bootstrap/scss/_custom-forms"; @import "~bootstrap/scss/_nav"; diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/manage/people.component.html b/bitwarden_license/bit-web/src/app/admin-console/providers/manage/people.component.html index 152253fe4d..90160daead 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/manage/people.component.html +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/manage/people.component.html @@ -1,48 +1,37 @@