getAll ciphers FromApiForOrganization
This commit is contained in:
parent
e55926336c
commit
e10523cc61
|
@ -22,6 +22,7 @@ export abstract class CipherService {
|
|||
getAllDecrypted: () => Promise<CipherView[]>;
|
||||
getAllDecryptedForGrouping: (groupingId: string, folder?: boolean) => Promise<CipherView[]>;
|
||||
getAllDecryptedForUrl: (url: string, includeOtherTypes?: CipherType[]) => Promise<CipherView[]>;
|
||||
getAllFromApiForOrganization: (organizationId: string) => Promise<CipherView[]>;
|
||||
getLastUsedForUrl: (url: string) => Promise<CipherView>;
|
||||
updateLastUsedDate: (id: string) => Promise<void>;
|
||||
saveNeverDomain: (domain: string) => Promise<void>;
|
||||
|
|
|
@ -405,6 +405,24 @@ export class CipherService implements CipherServiceAbstraction {
|
|||
});
|
||||
}
|
||||
|
||||
async getAllFromApiForOrganization(organizationId: string): Promise<CipherView[]> {
|
||||
const ciphers = await this.apiService.getCiphersOrganization(organizationId);
|
||||
if (ciphers != null && ciphers.data != null && ciphers.data.length) {
|
||||
const decCiphers: CipherView[] = [];
|
||||
const promises: any[] = [];
|
||||
ciphers.data.forEach((r) => {
|
||||
const data = new CipherData(r);
|
||||
const cipher = new Cipher(data);
|
||||
promises.push(cipher.decrypt().then((c) => decCiphers.push(c)));
|
||||
});
|
||||
await Promise.all(promises);
|
||||
decCiphers.sort(this.getLocaleSortingFunction());
|
||||
return decCiphers;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
async getLastUsedForUrl(url: string): Promise<CipherView> {
|
||||
const ciphers = await this.getAllDecryptedForUrl(url);
|
||||
if (ciphers.length === 0) {
|
||||
|
|
Loading…
Reference in New Issue