mirror of https://github.com/bitwarden/web.git
Browse Source
* [fix] Pull org admin vault collections directly from the API
* [refactor] Establish pattern for interfaces in module scoped services
* [fix] Remove access modifiers from constructor params for an extended service
* [fix] Rename skipFilterCollectionRefresh to firstLoaded
* [fix] Simplify hiding unwanted filters in the org vault
* Revert "[refactor] Establish pattern for interfaces in module scoped services"
This reverts commit f1edae5a3e.
* Update src/app/modules/vault-filter/vault-filter.component.ts
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
* Update src/app/modules/vault-filter/organization-vault-filter.component.ts
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
* [fix] Ran prettier
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
rc
8 changed files with 111 additions and 57 deletions
@ -1 +1 @@
@@ -1 +1 @@
|
||||
Subproject commit 1cc4bed67170ac92b92cb46e8bbcf7c59ea166db |
||||
Subproject commit 6f117b990192ddbe3b630effc77f4ef3c2bf248c |
||||
@ -0,0 +1,28 @@
@@ -0,0 +1,28 @@
|
||||
import { Component, Input } from "@angular/core"; |
||||
|
||||
import { Organization } from "jslib-common/models/domain/organization"; |
||||
|
||||
import { VaultFilterComponent } from "./vault-filter.component"; |
||||
|
||||
@Component({ |
||||
selector: "app-organization-vault-filter", |
||||
templateUrl: "vault-filter.component.html", |
||||
}) |
||||
export class OrganizationVaultFilterComponent extends VaultFilterComponent { |
||||
hideOrganizations = true; |
||||
hideFavorites = true; |
||||
hideFolders = true; |
||||
|
||||
organization: Organization; |
||||
|
||||
async initCollections() { |
||||
if (this.organization.canEditAnyCollection) { |
||||
return await this.vaultFilterService.buildAdminCollections(this.organization.id); |
||||
} |
||||
return await this.vaultFilterService.buildCollections(this.organization.id); |
||||
} |
||||
|
||||
async reloadCollectionsAndFolders() { |
||||
this.collections = await this.initCollections(); |
||||
} |
||||
} |
||||
@ -1,3 +1,54 @@
@@ -1,3 +1,54 @@
|
||||
import { Injectable } from "@angular/core"; |
||||
|
||||
import { DynamicTreeNode } from "jslib-angular/modules/vault-filter/models/dynamic-tree-node.model"; |
||||
import { VaultFilterService as BaseVaultFilterService } from "jslib-angular/modules/vault-filter/vault-filter.service"; |
||||
import { ApiService } from "jslib-common/abstractions/api.service"; |
||||
import { CipherService } from "jslib-common/abstractions/cipher.service"; |
||||
import { CollectionService } from "jslib-common/abstractions/collection.service"; |
||||
import { FolderService } from "jslib-common/abstractions/folder.service"; |
||||
import { OrganizationService } from "jslib-common/abstractions/organization.service"; |
||||
import { PolicyService } from "jslib-common/abstractions/policy.service"; |
||||
import { StateService } from "jslib-common/abstractions/state.service"; |
||||
import { CollectionData } from "jslib-common/models/data/collectionData"; |
||||
import { Collection } from "jslib-common/models/domain/collection"; |
||||
import { CollectionDetailsResponse } from "jslib-common/models/response/collectionResponse"; |
||||
import { CollectionView } from "jslib-common/models/view/collectionView"; |
||||
|
||||
@Injectable() |
||||
export class VaultFilterService extends BaseVaultFilterService { |
||||
constructor( |
||||
stateService: StateService, |
||||
organizationService: OrganizationService, |
||||
folderService: FolderService, |
||||
cipherService: CipherService, |
||||
collectionService: CollectionService, |
||||
policyService: PolicyService, |
||||
protected apiService: ApiService |
||||
) { |
||||
super( |
||||
stateService, |
||||
organizationService, |
||||
folderService, |
||||
cipherService, |
||||
collectionService, |
||||
policyService |
||||
); |
||||
} |
||||
|
||||
async buildAdminCollections(organizationId: string) { |
||||
let result: CollectionView[] = []; |
||||
const collectionResponse = await this.apiService.getCollections(organizationId); |
||||
if (collectionResponse?.data != null && collectionResponse.data.length) { |
||||
const collectionDomains = collectionResponse.data.map( |
||||
(r: CollectionDetailsResponse) => new Collection(new CollectionData(r)) |
||||
); |
||||
result = await this.collectionService.decryptMany(collectionDomains); |
||||
} |
||||
|
||||
export class VaultFilterService extends BaseVaultFilterService {} |
||||
const nestedCollections = await this.collectionService.getAllNested(result); |
||||
return new DynamicTreeNode<CollectionView>({ |
||||
fullList: result, |
||||
nestedList: nestedCollections, |
||||
}); |
||||
} |
||||
} |
||||
|
||||
Loading…
Reference in new issue