mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
* Replace Permissions enum and helper methods with callbacks * Remove scim feature flag * Check if org has feature enabled as part of canManage checks * Pin jest-mock-extended at v2.0.6 to fix compilation error
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { Component, Input, OnInit } from "@angular/core";
|
|
|
|
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
|
import { OrganizationService } from "@bitwarden/common/abstractions/organization.service";
|
|
import { Utils } from "@bitwarden/common/misc/utils";
|
|
import { Organization } from "@bitwarden/common/models/domain/organization";
|
|
|
|
import { canAccessOrgAdmin } from "../organizations/navigation-permissions";
|
|
|
|
@Component({
|
|
selector: "app-organization-switcher",
|
|
templateUrl: "organization-switcher.component.html",
|
|
})
|
|
export class OrganizationSwitcherComponent implements OnInit {
|
|
constructor(private organizationService: OrganizationService, private i18nService: I18nService) {}
|
|
|
|
@Input() activeOrganization: Organization = null;
|
|
organizations: Organization[] = [];
|
|
|
|
loaded = false;
|
|
|
|
async ngOnInit() {
|
|
await this.load();
|
|
}
|
|
|
|
async load() {
|
|
const orgs = await this.organizationService.getAll();
|
|
this.organizations = orgs
|
|
.filter(canAccessOrgAdmin)
|
|
.sort(Utils.getSortFunction(this.i18nService, "name"));
|
|
|
|
this.loaded = true;
|
|
}
|
|
}
|