";
- logger.trace("Formatting "+aclOwner.size() +" ACL/s");
+ logger.trace("Formatting " + acls.size() + " ACL/s");
- for (ACLType type : aclOwner.keySet()) {
+ Map
> aclOwner = new HashMap<>();
+
+ for (ACL acl : acls) {
+ for (AccessType accessType : acl.getAccessTypes()) {
+ if (aclOwner.containsKey(accessType)) {
+ List users = aclOwner.get(accessType);
+ boolean notfound = true;
+ for (String user : users) {
+ if (user.compareTo(acl.getPricipal()) == 0) {
+ notfound = false;
+ break;
+ }
+ }
+ if (notfound) {
+ users.add(acl.getPricipal());
+ aclOwner.put(accessType, users);
+ }
+ } else {
+ List users = new ArrayList();
+ users.add(acl.getPricipal());
+ aclOwner.put(accessType, users);
+ }
+ }
+ }
+
+ for (AccessType type : aclOwner.keySet()) {
List listLogins = aclOwner.get(type);
- html+=""+type+": ";
- html+="";
+ html += "" + type + ": ";
+ html += "";
for (String login : listLogins) {
- logger.trace("Adding login "+login);
- String fullName = UserUtil.getUserFullName(login);
- if(fullName!=null && !fullName.isEmpty())
- html+=fullName+"; ";
- else
- html+=login+"; ";
+ logger.trace("Adding login " + login);
+ String fullName = UserUtil.getUserFullName(login);
+ if (fullName != null && !fullName.isEmpty())
+ html += fullName + "; ";
+ else
+ html += login + "; ";
}
- html+="
";
+ html += "
";
}
- html+=" ";
-
+ html += "";
return html;
}
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 0b8ab10..49bf3da 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
@@ -2,41 +2,47 @@ package org.gcube.portlets.widgets.workspacesharingwidget.server;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.gcube.common.homelibary.model.items.type.WorkspaceItemType;
import org.gcube.common.homelibrary.home.HomeLibrary;
-import org.gcube.common.homelibrary.home.exceptions.HomeNotFoundException;
-import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
import org.gcube.common.homelibrary.home.workspace.Workspace;
import org.gcube.common.homelibrary.home.workspace.WorkspaceFolder;
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
import org.gcube.common.homelibrary.home.workspace.WorkspaceSharedFolder;
import org.gcube.common.homelibrary.home.workspace.accessmanager.ACLType;
-import org.gcube.common.homelibrary.home.workspace.exceptions.InsufficientPrivilegesException;
-import org.gcube.common.homelibrary.home.workspace.exceptions.ItemAlreadyExistException;
-import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundException;
-import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
-import org.gcube.common.homelibrary.home.workspace.exceptions.WrongDestinationException;
-import org.gcube.common.homelibrary.home.workspace.usermanager.GCubeGroup;
-import org.gcube.common.portal.PortalContext;
+import org.gcube.common.scope.api.ScopeProvider;
+import org.gcube.common.storagehub.client.dsl.FolderContainer;
+import org.gcube.common.storagehub.client.dsl.ItemContainer;
+import org.gcube.common.storagehub.client.dsl.OpenResolver;
+import org.gcube.common.storagehub.client.dsl.StorageHubClient;
+import org.gcube.common.storagehub.model.Metadata;
+import org.gcube.common.storagehub.model.acls.ACL;
+import org.gcube.common.storagehub.model.acls.AccessType;
+import org.gcube.common.storagehub.model.items.FolderItem;
+import org.gcube.common.storagehub.model.items.Item;
+import org.gcube.common.storagehub.model.items.SharedFolder;
import org.gcube.portlets.widgets.workspacesharingwidget.client.ConstantsSharing;
import org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingService;
import org.gcube.portlets.widgets.workspacesharingwidget.server.notifications.NotificationsProducer;
+import org.gcube.portlets.widgets.workspacesharingwidget.server.util.AccessTypeComparator;
import org.gcube.portlets.widgets.workspacesharingwidget.server.util.PortalContextInfo;
import org.gcube.portlets.widgets.workspacesharingwidget.server.util.ScopeUtility;
import org.gcube.portlets.widgets.workspacesharingwidget.server.util.UserUtil;
import org.gcube.portlets.widgets.workspacesharingwidget.server.util.WsUtil;
+import org.gcube.portlets.widgets.workspacesharingwidget.shared.AllowAccess;
import org.gcube.portlets.widgets.workspacesharingwidget.shared.CredentialModel;
+import org.gcube.portlets.widgets.workspacesharingwidget.shared.ExtendedWorkspaceACL;
import org.gcube.portlets.widgets.workspacesharingwidget.shared.FileModel;
import org.gcube.portlets.widgets.workspacesharingwidget.shared.InfoContactModel;
+import org.gcube.portlets.widgets.workspacesharingwidget.shared.ReportAssignmentACL;
import org.gcube.portlets.widgets.workspacesharingwidget.shared.SessionExpiredException;
import org.gcube.portlets.widgets.workspacesharingwidget.shared.WorkspaceACL;
-import org.gcube.portlets.widgets.workspacesharingwidget.shared.system.VO;
-import org.gcube.portlets.widgets.workspacesharingwidget.shared.system.VRE;
-import org.gcube.vomanagement.usermanagement.model.GCubeUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,46 +51,21 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
/**
* The server side implementation of the RPC service.
*
- * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
- * Aug 3, 2015
+ * @author Francesco Mangiacrapa Aug 3, 2015
*/
@SuppressWarnings("serial")
-public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
- WorkspaceSharingService {
+public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements WorkspaceSharingService {
protected static Logger logger = LoggerFactory.getLogger(WorkspaceSharingServiceImpl.class);
-
- /**
- * Gets the GWT workspace builder.
- *
- * @return the GWT workspace builder
- */
- protected GWTWorkspaceSharingBuilder getGWTWorkspaceBuilder()
- {
- return WsUtil.getGWTWorkspaceSharingBuilder(this.getThreadLocalRequest());
- }
-
- /**
- * Gets the workspace.
- *
- * @return the workspace
- * @throws InternalErrorException the internal error exception
- * @throws HomeNotFoundException the home not found exception
- * @throws WorkspaceFolderNotFoundException the workspace folder not found exception
- */
- protected Workspace getWorkspace() throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException
- {
- return WsUtil.getWorkspace(this.getThreadLocalRequest());
- }
-
/**
* Gets the notification producer.
*
- * @param request the request
+ * @param request
+ * the request
* @return the notification producer
*/
- protected NotificationsProducer getNotificationProducer(HttpServletRequest request){
+ protected NotificationsProducer getNotificationProducer(HttpServletRequest request) {
return WsUtil.getNotificationProducer(request);
}
@@ -94,7 +75,7 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
*
* @return the scope util filter
*/
- protected ScopeUtility getScopeUtilFilter(){
+ protected ScopeUtility getScopeUtilFilter() {
return WsUtil.getScopeUtilFilter(this.getThreadLocalRequest());
}
@@ -104,25 +85,24 @@ public class WorkspaceSharingServiceImpl extends RemoteServiceServlet implements
*
* @return true, if is test mode
*/
- protected boolean isTestMode(){
- return !WsUtil.isWithinPortal(); //IS NOT INTO PORTAL
+ protected boolean isTestMode() {
+ return !WsUtil.isWithinPortal(); // IS NOT INTO PORTAL
}
- /* (non-Javadoc)
- * @see org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.WorkspaceSharingService#getAllContacts(boolean, boolean)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.gcube.portlets.widgets.workspacesharingwidget.client.rpc.
+ * WorkspaceSharingService#getAllContacts(boolean, boolean)
*/
@Override
- public List