From 622d90fdec122977a53878c9b51bcbf6eabc7cd3 Mon Sep 17 00:00:00 2001 From: Ivan Mitev <> Date: Thu, 11 Dec 2025 23:46:54 +0100 Subject: [PATCH] FIX: Organisation profile view rights bug --- src/app/app-routing.module.ts | 2 +- .../billing-info/billing-info.component.html | 40 +-- .../billing-info/billing-info.component.ts | 9 + .../org-info/org-info.component.html | 267 ++++++++++-------- .../org-info/org-info.component.ts | 25 +- src/app/shared/header/header.component.html | 8 +- 6 files changed, 207 insertions(+), 144 deletions(-) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index ad043153..bd5d8259 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -72,7 +72,7 @@ const routes: Routes = [ }, { path: 'profile', component: UserProfileComponent, - canActivate: [AuthGuard], data: { roles: ['individual','orgAdmin'] } + canActivate: [AuthGuard], data: { roles: [] } }, { path: 'my-offerings', component: SellerOfferingsComponent, diff --git a/src/app/pages/user-profile/profile-sections/billing-info/billing-info.component.html b/src/app/pages/user-profile/profile-sections/billing-info/billing-info.component.html index fd495793..ec2517d5 100644 --- a/src/app/pages/user-profile/profile-sections/billing-info/billing-info.component.html +++ b/src/app/pages/user-profile/profile-sections/billing-info/billing-info.component.html @@ -26,9 +26,11 @@

{{ 'BILLING._phone' | translate }} - - {{ 'BILLING._action' | translate }} - + @if(!isReadOnly){ + + {{ 'BILLING._action' | translate }} + + } @@ -49,18 +51,20 @@

({{bill.telephoneType}}) {{bill.telephoneNumber}} - - - - + + + + } } @empty {
@@ -77,9 +81,11 @@

{{ 'BILLING._add' | translate }}

-
- + @if(!isReadOnly){ +

{{ 'BILLING._add' | translate }}

+
+ + }
} diff --git a/src/app/pages/user-profile/profile-sections/billing-info/billing-info.component.ts b/src/app/pages/user-profile/profile-sections/billing-info/billing-info.component.ts index fd3eb82d..affcbe12 100644 --- a/src/app/pages/user-profile/profile-sections/billing-info/billing-info.component.ts +++ b/src/app/pages/user-profile/profile-sections/billing-info/billing-info.component.ts @@ -41,6 +41,7 @@ export class BillingInfoComponent implements OnInit{ selectedDate:any; countries: any[] = countries; preferred:boolean=false; + isReadOnly:boolean=false; errorMessage:any=''; showError:boolean=false; @@ -105,6 +106,13 @@ export class BillingInfoComponent implements OnInit{ href : this.partyId, role: "Owner" } + + // Check if user has orgAdmin role for edit permission + if(loggedOrg && loggedOrg.roles){ + const orgRoles = loggedOrg.roles.map((role: any) => role.name); + const hasOrgAdminRole = orgRoles.some((role: any) => role === 'orgAdmin'); + this.isReadOnly = !hasOrgAdminRole; + } } else { this.partyId = aux.partyId; console.log('init party info') @@ -115,6 +123,7 @@ export class BillingInfoComponent implements OnInit{ href : this.partyId, role: "Owner" } + this.isReadOnly = false; } this.getBilling(); } diff --git a/src/app/pages/user-profile/profile-sections/org-info/org-info.component.html b/src/app/pages/user-profile/profile-sections/org-info/org-info.component.html index cb666209..cf6da907 100644 --- a/src/app/pages/user-profile/profile-sections/org-info/org-info.component.html +++ b/src/app/pages/user-profile/profile-sections/org-info/org-info.component.html @@ -13,21 +13,35 @@

{{ 'PROFILE._name' | translate }} (*) - + @if(profileForm.get('name')?.invalid && profileForm.get('name')?.errors?.['required'] && (profileForm.get('name')?.touched && profileForm.value.name=='')){

This field is mandatory.

- } + }
{{ 'PROFILE._website' | translate }} - +
{{ 'PROFILE._country' | translate }} (*) - @@ -35,114 +49,128 @@

{{ 'UPDATE_OFFER._description' | translate }} -
-
-
-
- - - - - - - - - - + @if(isReadOnly) { + +
+
+ +
+
+ } @else { + +
+
+
+
+ + + + + + + + + + +
+
+ +
- - -
- - @if(showPreview){ - - - }@else{ - - } - @if(showEmoji){ - - } - -
-
+ } + @if(!isReadOnly){

{{ 'PROFILE._add_logo' | translate }}

@@ -219,7 +247,8 @@

Logo requirements

} - + } +

{{ 'PROFILE._contact_info' | translate }}


@@ -232,9 +261,11 @@

{{ 'PROFILE._info' | translate }} - - {{ 'PROFILE._actions' | translate }} - + @if(!isReadOnly){ + + {{ 'PROFILE._actions' | translate }} + + } @@ -250,8 +281,9 @@

@@ -387,6 +421,7 @@

{{email}}

    - @if(loggedAsOrg == false || roles.includes('orgAdmin')) { -
  • - -
  • - } +
  • + +
  • @if(roles.includes('seller')){