[Feature #13327] Checking upload permission before the upload starting
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/workspace-uploader@181695 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
adfd7f4839
commit
c1e9f1f89e
|
@ -5,6 +5,9 @@
|
||||||
<Change>[Task #17152] Workspace uploader: avoid . (dot) char added as
|
<Change>[Task #17152] Workspace uploader: avoid . (dot) char added as
|
||||||
suffix when the filename does not contain an extension
|
suffix when the filename does not contain an extension
|
||||||
</Change>
|
</Change>
|
||||||
|
<Change>
|
||||||
|
[Feature #13327] Checking upload permission before the upload starting
|
||||||
|
</Change>
|
||||||
</Changeset>
|
</Changeset>
|
||||||
<Changeset
|
<Changeset
|
||||||
component="org.gcube.portlets-widgets.workspace-uploader.2-0-2"
|
component="org.gcube.portlets-widgets.workspace-uploader.2-0-2"
|
||||||
|
|
|
@ -471,26 +471,19 @@ public class WorkspaceUploadServletStream extends HttpServlet implements Servlet
|
||||||
if (!destinationItem.isFolder()) {
|
if (!destinationItem.isFolder()) {
|
||||||
logger.error("Error processing request in upload servlet: The destination is not a folder");
|
logger.error("Error processing request in upload servlet: The destination is not a folder");
|
||||||
saveWorkspaceUploaderStatus(workspaceUploader, UPLOAD_STATUS.FAILED, "An error occurred during upload: "+fileName+". The destination is not a folder", request.getSession());
|
saveWorkspaceUploaderStatus(workspaceUploader, UPLOAD_STATUS.FAILED, "An error occurred during upload: "+fileName+". The destination is not a folder", request.getSession());
|
||||||
sendError(response, "Internal error: Wrong destination item");
|
sendError(response, "Internal error: Wrong destination item. The destination is not a folder");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final WorkspaceFolder destinationFolder = (WorkspaceFolder) destinationItem;
|
final WorkspaceFolder destinationFolder = (WorkspaceFolder) destinationItem;
|
||||||
|
|
||||||
if(destinationFolder.isShared()) {
|
try {
|
||||||
try {
|
workspace.canUserWriteIntoFolder(destinationFolder.getId());
|
||||||
WorkspaceItem rootSharedFolder = workspace.getRootSharedFolder(destinationFolder.getId());
|
} catch (Exception e1) {
|
||||||
|
logger.warn("The user cannot write in the destination folder with id: {}",destinationFolder.getId());
|
||||||
//TODO RETRIEVE USERS BELONGING TO SHARE
|
saveWorkspaceUploaderStatus(workspaceUploader, UPLOAD_STATUS.FAILED, "You are not authorized to write into folder: "+destinationFolder.getName(), request.getSession());
|
||||||
//TODO RETRIEVE ACL
|
sendError(response, "Internal error: You are not authorized to write into folder: "+destinationFolder.getName());
|
||||||
|
return;
|
||||||
if(rootSharedFolder instanceof WorkspaceSharedFolder) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue