From 65640726a197053f52281cd317bf4911b9275966 Mon Sep 17 00:00:00 2001
From: Kartheek Palla <palla.kartheekreddy@gmail.com>
Date: Thu, 17 Feb 2022 11:49:43 +0530
Subject: [PATCH] Issue #SB-28654 fix: user role issue fix

---
 src/service/programService.js | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/service/programService.js b/src/service/programService.js
index ea81892..f7ab7b5 100644
--- a/src/service/programService.js
+++ b/src/service/programService.js
@@ -2652,12 +2652,14 @@ function publishContent(req, response){
 
 function getUserOrganisationRoles(profileData, rootorg_id) {
   let userRoles = ['PUBLIC'];
-  if (profileData.organisations) {
-    let thisOrg = _.find(profileData.organisations, {
-      organisationId: rootorg_id
-    });
-    userRoles = _.union(userRoles, thisOrg.roles);
-  }
+  userRoles = _.uniq(_.union(userRoles, _.map(profileData.roles, 'role')));
+  // if (profileData.organisations) {
+  //   let thisOrg = _.find(profileData.organisations, {
+  //     organisationId: rootorg_id
+  //   });
+  //   userRoles = _.union(userRoles, thisOrg.roles);
+  // }
+
   return userRoles;
 }
 
-- 
GitLab