Fixed hidden parameter for currUserId in client side

See #6275 

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-uploader@141357 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-12-22 09:26:36 +00:00
parent 7a658e4f68
commit 308fb4cc73
3 changed files with 6 additions and 27 deletions

View File

@ -94,8 +94,8 @@ public class DialogUpload extends ClosableDialog implements HasWorskpaceUploadNo
formPanel.setEncoding(FormPanel.ENCODING_MULTIPART);
formPanel.setMethod(FormPanel.METHOD_POST);
formPanel.setWidth("auto");
// Create a panel to hold all of the form widgets.
panel = new VerticalPanel();
formPanel.setWidget(panel);
@ -105,6 +105,7 @@ public class DialogUpload extends ClosableDialog implements HasWorskpaceUploadNo
// Add hidden parameters
panel.add(new Hidden(ConstantsWorkspaceUploader.CURR_GROUP_ID, GCubeClientContext.getCurrentContextId()));
panel.add(new Hidden(ConstantsWorkspaceUploader.CURR_USER_ID, GCubeClientContext.getCurrentUserId()));
panel.add(new Hidden(ConstantsWorkspaceUploader.ID_FOLDER,parentId));
panel.add(new Hidden(ConstantsWorkspaceUploader.UPLOAD_TYPE,uploadType.toString()));

View File

@ -252,7 +252,7 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
if (item.isFormField() && CURR_USER_ID.equals(item.getFieldName())){
currUserId = Streams.asString(item.openStream());
logger.debug("currUserId passed as parameter = " + currUserId);
logger.debug("currUserId into PortalContext scope= " + PortalContext.getConfiguration().getCurrentUser(request));
logger.debug("currUserinto PortalContext = " + PortalContext.getConfiguration().getCurrentUser(request));
}
//MUST BE THE LAST PARAMETER TRASMITTED
@ -513,6 +513,7 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
if (MimeTypeUtil.isZipContentType(uploadItem.getContentType())){ //UNZIP??
logger.debug("Unziping content");
//THE WORKSPACE HAS BEEN INSTANCIED ABOVE
workspaceUploader = WorkspaceUploaderMng.uploadArchive(currUserId, scopeGroupId, workspaceUploader, request, itemName, inputStream, destinationFolder, size);
if(workspaceUploader==null)
@ -520,6 +521,7 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
sendMessage(response, workspaceUploader.getIdentifier());
} else{
//THE WORKSPACE HAS BEEN INSTANCIED ABOVE
workspaceUploader = WorkspaceUploaderMng.uploadFile(currUserId, scopeGroupId, request, workspaceUploader, request.getSession(), wa, itemName, inputStream, destinationFolder, contentType, isOverwrite, size);
if(workspaceUploader==null)

View File

@ -89,30 +89,6 @@ public class WsUtil {
return HomeLibrary.getUserWorkspace(username);
}
// /**
// * Gets the workspace.
// *
// * @param username the username
// * @param scopeGroupId the scope group id
// * @param currUserId the curr user id
// * @return the workspace
// * @throws InternalErrorException the internal error exception
// * @throws HomeNotFoundException the home not found exception
// * @throws WorkspaceFolderNotFoundException the workspace folder not found exception
// */
// public static Workspace getWorkspace(String username, String scopeGroupId, String currUserId) throws InternalErrorException, HomeNotFoundException, WorkspaceFolderNotFoundException{
//
// logger.trace("Get Workspace for user = " + username);
// PortalContext pContext = PortalContext.getConfiguration();
// String scope = pContext.getCurrentScope(scopeGroupId);
// logger.trace("Client context scope: "+ scope + " username: "+username);
//
// ScopeProvider.instance.set(scope);
// return HomeLibrary.getUserWorkspace(username);
// }
/**
* Put workspace uploader in session.
*