From ff3ff89e20ff50bc5b2452e0d1e6f8773e732b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rui=20Tom=C3=A9?= <108268980+r-tome@users.noreply.github.com> Date: Wed, 3 Apr 2024 15:51:21 +0100 Subject: [PATCH] [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) --- .../layouts/organization-layout.component.html | 2 +- .../organizations/layouts/organization-layout.component.ts | 6 ++++++ .../src/app/layouts/org-switcher/org-switcher.component.ts | 1 - 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/web/src/app/admin-console/organizations/layouts/organization-layout.component.html b/apps/web/src/app/admin-console/organizations/layouts/organization-layout.component.html index 348c410075..b9a277a2e9 100644 --- a/apps/web/src/app/admin-console/organizations/layouts/organization-layout.component.html +++ b/apps/web/src/app/admin-console/organizations/layouts/organization-layout.component.html @@ -3,7 +3,7 @@ - + ; showPaymentAndHistory$: Observable; + hideNewOrgButton$: Observable; private _destroy = new Subject(); @@ -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() { diff --git a/apps/web/src/app/layouts/org-switcher/org-switcher.component.ts b/apps/web/src/app/layouts/org-switcher/org-switcher.component.ts index 2c44a045c7..fc77e79a12 100644 --- a/apps/web/src/app/layouts/org-switcher/org-switcher.component.ts +++ b/apps/web/src/app/layouts/org-switcher/org-switcher.component.ts @@ -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;