1
0
mirror of https://github.com/bitwarden/web synced 2025-12-06 00:03:28 +00:00

[Provider] Verify user is owner of organization (#1167)

(cherry picked from commit e69e85d8b3)
This commit is contained in:
Oscar Hinton
2021-08-31 19:01:29 +02:00
committed by Hinton
parent 2fe196df5e
commit 2b5981ab75

View File

@@ -82,7 +82,7 @@ export class ClientsComponent implements OnInit {
const response = await this.apiService.getProviderClients(this.providerId);
this.clients = response.data != null && response.data.length > 0 ? response.data : [];
this.manageOrganizations = (await this.userService.getProvider(this.providerId)).type === ProviderUserType.ProviderAdmin;
const candidateOrgs = (await this.userService.getAllOrganizations()).filter(o => o.providerId == null);
const candidateOrgs = (await this.userService.getAllOrganizations()).filter(o => o.isOwner && o.providerId == null);
const allowedOrgsIds = await Promise.all(candidateOrgs.map(o => this.apiService.getOrganization(o.id))).then(orgs =>
orgs.filter(o => !DisallowedPlanTypes.includes(o.planType))
.map(o => o.id));