1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-23 11:43:46 +00:00

[feature] Implement scope warning for exports (#688)

* [feature] Add a hasOrganizations() service method

* [feature] Add a component to warn users about export scope
This commit is contained in:
Addison Beck
2022-02-22 22:56:46 -05:00
committed by GitHub
parent 1fb3d54014
commit 78b5f15042
4 changed files with 54 additions and 0 deletions

View File

@@ -7,4 +7,5 @@ export abstract class OrganizationService {
getAll: (userId?: string) => Promise<Organization[]>;
save: (orgs: { [id: string]: OrganizationData }) => Promise<any>;
canManageSponsorships: () => Promise<boolean>;
hasOrganizations: (userId?: string) => Promise<boolean>;
}

View File

@@ -47,4 +47,9 @@ export class OrganizationService implements OrganizationServiceAbstraction {
(o) => o.familySponsorshipAvailable || o.familySponsorshipFriendlyName !== null
);
}
async hasOrganizations(userId?: string): Promise<boolean> {
const organizations = await this.getAll(userId);
return organizations.length > 0;
}
}