diff --git a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/server/WorkspaceSharingServiceImpl.java b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/server/WorkspaceSharingServiceImpl.java index 12f472b..e847360 100644 --- a/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/server/WorkspaceSharingServiceImpl.java +++ b/src/main/java/org/gcube/portlets/widgets/workspacesharingwidget/server/WorkspaceSharingServiceImpl.java @@ -741,7 +741,7 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements // logger.info("Retrieving old administator/s are/is:" + // oldAdmins.size()); - logger.info("Setting administators:"); + logger.info("Setting administators: "+listContactLogins); sharedFolder.setAdmins(listContactLogins); /* @@ -1164,7 +1164,7 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements } } - // TODO + private List retrieveUserACLsFromFolderContainer(FolderContainer folderContainer) throws Exception { String currentUser = getMyLogin(); logger.debug("Current User: " + currentUser); @@ -1180,6 +1180,7 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements List wsAcls = null; if (currentUserACL == null) { + logger.debug("Search if user is in a group"); List listVRE = retrieveCurrentUserACLFromGroup(currentUser); int i = 0; while (currentUserACL == null && i < listVRE.size()) { @@ -1189,13 +1190,15 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements String principal = acl.getPricipal(); String rootVO = PortalContext.getConfiguration().getInfrastructureName(); if (principal.startsWith(rootVO)) { - int voIndex = principal.indexOf("-"); + String tempScope=principal.substring(rootVO.length()); + int voIndex = tempScope.indexOf("-"); if (voIndex != -1) { - String tempScope = principal.substring(voIndex + 1); + tempScope = tempScope.substring(voIndex + 1); int vreIndex = tempScope.indexOf("-"); if (vreIndex != -1) { tempScope = tempScope.substring(vreIndex + 1); if (tempScope.compareTo(vreName) == 0) { + logger.debug("User is member of: "+principal); currentUserACL = acl; break; } @@ -1206,8 +1209,11 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements i++; } if (currentUserACL != null) { + logger.debug("Permission found: "+currentUserACL); GWTWorkspaceSharingBuilder builder = new GWTWorkspaceSharingBuilder(); wsAcls = builder.getWorkspaceACLForUser(currentUserACL); + } else { + logger.debug("The user does not have permissions for this item."); } } else { GWTWorkspaceSharingBuilder builder = new GWTWorkspaceSharingBuilder(); @@ -1236,10 +1242,11 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements List listOfGroups = groupManager.listGroupsByUser(userId); List vres = new ArrayList(); for (GCubeGroup g : listOfGroups) { - if (groupManager.isVRE(g.getGroupId())) + if (groupManager.isVRE(g.getGroupId())){ vres.add(g); + } } - logger.debug("Current User VREs: " + vres); + logger.debug("VREs of user retrieved"); return vres; } catch (Throwable e) { logger.error("Error retrieving User group: " + e.getLocalizedMessage(), e);