Fixed Get Info for shared Folder

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-sharing-widget@179458 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2019-05-16 13:21:01 +00:00
parent 66b42cab91
commit cbc49652b1
1 changed files with 13 additions and 6 deletions

View File

@ -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<WorkspaceACL> retrieveUserACLsFromFolderContainer(FolderContainer folderContainer) throws Exception {
String currentUser = getMyLogin();
logger.debug("Current User: " + currentUser);
@ -1180,6 +1180,7 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
List<WorkspaceACL> wsAcls = null;
if (currentUserACL == null) {
logger.debug("Search if user is in a group");
List<GCubeGroup> 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<GCubeGroup> listOfGroups = groupManager.listGroupsByUser(userId);
List<GCubeGroup> vres = new ArrayList<GCubeGroup>();
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);