Catching specific UserNotAuthorized

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@179252 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2019-05-03 13:31:47 +00:00
parent 0feb1f5ead
commit 5bdbed4d6b
1 changed files with 12 additions and 4 deletions

View File

@ -43,6 +43,7 @@ import org.gcube.common.homelibrary.home.workspace.search.SearchItem;
import org.gcube.common.portal.PortalContext;
import org.gcube.common.resources.gcore.ServiceEndpoint;
import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.storagehub.model.exceptions.UserNotAuthorizedException;
import org.gcube.common.storagehubwrapper.server.StorageHubWrapper;
import org.gcube.common.storagehubwrapper.shared.tohl.TrashedItem;
import org.gcube.common.storagehubwrapper.shared.tohl.impl.WorkspaceFileVersion;
@ -2483,6 +2484,12 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
String error = "An error occurred on deleting item. " + ConstantsExplorer.ERROR_ITEM_DOES_NOT_EXIST;
workspaceLogger.error(error, e);
throw new Exception(error);
//TO STORAGEHUB EXCEPTION
} catch (UserNotAuthorizedException e) {
String error = "Insufficient Privileges to delete the item";
workspaceLogger.error(error, e);
throw new Exception(error);
} catch (Exception e) {
workspaceLogger.error("Remoing item error:", e);
StringBuilder error = new StringBuilder();
@ -3380,10 +3387,6 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
} catch (WorkspaceFolderLocked e1) {
throw new Exception(e1.getMessage());
} catch (InsufficientPrivilegesException e) {
String error = "Insufficient Privileges to rename the item";
workspaceLogger.error(error, e);
throw new Exception(error);
} catch (ItemAlreadyExistException e) {
String error = "An error occurred on renaming item, " + e.getMessage();
workspaceLogger.error(error, e);
@ -3392,6 +3395,11 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
String error = "An error occurred on renaming item. " + ConstantsExplorer.ERROR_ITEM_DOES_NOT_EXIST;
workspaceLogger.error(error, e2);
throw new Exception(error);
//TO STORAGEHUB EXCEPTION
} catch (UserNotAuthorizedException e) {
String error = "Insufficient Privileges to rename the item";
workspaceLogger.error(error, e);
throw new Exception(error);
} catch (Exception e) {
workspaceLogger.error("Renaming item error:", e);
StringBuilder error = new StringBuilder();