manager sees their assigned collections from org vault view
This commit is contained in:
parent
668271bb31
commit
9b7478c0c7
2
jslib
2
jslib
|
@ -1 +1 @@
|
||||||
Subproject commit 00efae261684eb97e7fcd8fd77aa04bca5e87a72
|
Subproject commit 0d8e09b3f1da8e1377bad5cfea2bc0dfcc7701c0
|
|
@ -8,7 +8,11 @@ import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||||
import { CollectionData } from 'jslib/models/data/collectionData';
|
import { CollectionData } from 'jslib/models/data/collectionData';
|
||||||
import { Collection } from 'jslib/models/domain/collection';
|
import { Collection } from 'jslib/models/domain/collection';
|
||||||
import { Organization } from 'jslib/models/domain/organization';
|
import { Organization } from 'jslib/models/domain/organization';
|
||||||
import { CollectionDetailsResponse } from 'jslib/models/response/collectionResponse';
|
import {
|
||||||
|
CollectionDetailsResponse,
|
||||||
|
CollectionResponse,
|
||||||
|
} from 'jslib/models/response/collectionResponse';
|
||||||
|
import { ListResponse } from 'jslib/models/response/listResponse';
|
||||||
import { CollectionView } from 'jslib/models/view/collectionView';
|
import { CollectionView } from 'jslib/models/view/collectionView';
|
||||||
|
|
||||||
import { GroupingsComponent as BaseGroupingsComponent } from '../../vault/groupings.component';
|
import { GroupingsComponent as BaseGroupingsComponent } from '../../vault/groupings.component';
|
||||||
|
@ -26,11 +30,16 @@ export class GroupingsComponent extends BaseGroupingsComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadCollections() {
|
async loadCollections() {
|
||||||
if (!this.organization.isAdmin) {
|
if (!this.organization.isManager) {
|
||||||
await super.loadCollections(this.organization.id);
|
await super.loadCollections(this.organization.id);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const collections = await this.apiService.getCollections(this.organization.id);
|
let collections: ListResponse<CollectionResponse>;
|
||||||
|
if (this.organization.isAdmin) {
|
||||||
|
collections = await this.apiService.getCollections(this.organization.id);
|
||||||
|
} else {
|
||||||
|
collections = await this.apiService.getUserCollections();
|
||||||
|
}
|
||||||
if (collections != null && collections.data != null && collections.data.length) {
|
if (collections != null && collections.data != null && collections.data.length) {
|
||||||
const collectionDomains = collections.data.map((r) =>
|
const collectionDomains = collections.data.map((r) =>
|
||||||
new Collection(new CollectionData(r as CollectionDetailsResponse)));
|
new Collection(new CollectionData(r as CollectionDetailsResponse)));
|
||||||
|
@ -39,6 +48,7 @@ export class GroupingsComponent extends BaseGroupingsComponent {
|
||||||
this.collections = [];
|
this.collections = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.organization.isAdmin) {
|
||||||
const unassignedCollection = new CollectionView();
|
const unassignedCollection = new CollectionView();
|
||||||
unassignedCollection.name = this.i18nService.t('unassigned');
|
unassignedCollection.name = this.i18nService.t('unassigned');
|
||||||
unassignedCollection.id = 'unassigned';
|
unassignedCollection.id = 'unassigned';
|
||||||
|
@ -47,3 +57,4 @@ export class GroupingsComponent extends BaseGroupingsComponent {
|
||||||
this.collections.push(unassignedCollection);
|
this.collections.push(unassignedCollection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue