From c206010000e2483bd8c54604cfdac081f067f181 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Fri, 3 Mar 2017 17:26:35 +0000 Subject: [PATCH] moved to Catalogue Manager team role (see #7393) git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/grsf-manage-widget@144655 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../server/manage/GRSFNotificationService.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/server/manage/GRSFNotificationService.java b/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/server/manage/GRSFNotificationService.java index c8be604..4b4d7db 100644 --- a/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/server/manage/GRSFNotificationService.java +++ b/src/main/java/org/gcube/datacatalogue/grsf_manage_widget/server/manage/GRSFNotificationService.java @@ -31,6 +31,7 @@ import org.gcube.resources.discovery.client.queries.api.SimpleQuery; import org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager; import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager; import org.gcube.vomanagement.usermanagement.model.GCubeRole; +import org.gcube.vomanagement.usermanagement.model.GCubeTeam; import org.gcube.vomanagement.usermanagement.model.GCubeUser; import org.json.simple.JSONArray; import org.json.simple.JSONObject; @@ -95,7 +96,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS // session info for user public static final String GRSF_ADMIN_SESSION_KEY = "IS_GRSF_ADMIN"; - private static final String GRSF_ADMIN_ROLE = "GRSF-Admin"; + private static final String GRSF_CATALOGUE_MANAGER_ROLE = "Catalogue Manager"; // managed as Team Role /** * Instanciate the ckan util library. @@ -533,12 +534,10 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS return inSession; else{ PortalContext pContext = PortalContext.getConfiguration(); - List userRoles = new LiferayRoleManager().listRolesByUserAndGroup( - pContext.getCurrentUser(getThreadLocalRequest()).getUserId(), - pContext.getCurrentGroupId(getThreadLocalRequest())); + List teamRoles = new LiferayRoleManager().listTeamsByUserAndGroup(pContext.getCurrentUser(getThreadLocalRequest()).getUserId(), pContext.getCurrentGroupId(getThreadLocalRequest())); boolean toSetInSession = false; - for (GCubeRole gCubeRole : userRoles) { - if(gCubeRole.getRoleName().equals(GRSF_ADMIN_ROLE)){ + for (GCubeTeam team : teamRoles) { + if(team.getTeamName().equals(GRSF_CATALOGUE_MANAGER_ROLE)){ toSetInSession = true; break; } @@ -547,7 +546,7 @@ public class GRSFNotificationService extends RemoteServiceServlet implements GRS return toSetInSession; } }catch(Exception e){ - logger.error("Failed to check if the user has role " + GRSF_ADMIN_ROLE, e); + logger.error("Failed to check if the user has team " + GRSF_CATALOGUE_MANAGER_ROLE, e); } return false; }