mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-24 12:06:15 +01:00
[AC-1913] Update OrganizationLayoutComponent to use PolicyService to check if the user has the SingleOrg policy and use the value to hide the 'New Org' button (#8349)
This commit is contained in:
parent
2977616be4
commit
ff3ff89e20
@ -3,7 +3,7 @@
|
||||
<a routerLink="." class="tw-m-5 tw-mt-7 tw-block" [appA11yTitle]="'adminConsole' | i18n">
|
||||
<bit-icon [icon]="logo"></bit-icon>
|
||||
</a>
|
||||
<org-switcher [filter]="orgFilter"></org-switcher>
|
||||
<org-switcher [filter]="orgFilter" [hideNewButton]="hideNewOrgButton$ | async"></org-switcher>
|
||||
|
||||
<bit-nav-item
|
||||
icon="bwi-collection"
|
||||
|
@ -15,6 +15,8 @@ import {
|
||||
getOrganizationById,
|
||||
OrganizationService,
|
||||
} from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction";
|
||||
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
||||
import { PolicyType } from "@bitwarden/common/admin-console/enums";
|
||||
import { Organization } from "@bitwarden/common/admin-console/models/domain/organization";
|
||||
import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum";
|
||||
import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service";
|
||||
@ -48,6 +50,7 @@ export class OrganizationLayoutComponent implements OnInit, OnDestroy {
|
||||
|
||||
organization$: Observable<Organization>;
|
||||
showPaymentAndHistory$: Observable<boolean>;
|
||||
hideNewOrgButton$: Observable<boolean>;
|
||||
|
||||
private _destroy = new Subject<void>();
|
||||
|
||||
@ -61,6 +64,7 @@ export class OrganizationLayoutComponent implements OnInit, OnDestroy {
|
||||
private organizationService: OrganizationService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private configService: ConfigService,
|
||||
private policyService: PolicyService,
|
||||
) {}
|
||||
|
||||
async ngOnInit() {
|
||||
@ -85,6 +89,8 @@ export class OrganizationLayoutComponent implements OnInit, OnDestroy {
|
||||
org?.canEditPaymentMethods,
|
||||
),
|
||||
);
|
||||
|
||||
this.hideNewOrgButton$ = this.policyService.policyAppliesToActiveUser$(PolicyType.SingleOrg);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
@ -46,7 +46,6 @@ export class OrgSwitcherComponent {
|
||||
|
||||
/**
|
||||
* Visibility of the New Organization button
|
||||
* (Temporary; will be removed when ability to create organizations is added to SM.)
|
||||
*/
|
||||
@Input()
|
||||
hideNewButton = false;
|
||||
|
Loading…
Reference in New Issue
Block a user