bug fixed on reading ACLs from servlet
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@91930 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
cb6513c77b
commit
968fdff129
|
@ -233,6 +233,6 @@ public interface GWTWorkspaceService extends RemoteService{
|
|||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
String getACLsDescriptionForFolderId(String folderId) throws Exception;
|
||||
String getACLsDescriptionForSharedFolderId(String folderId) throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ public interface GWTWorkspaceServiceAsync {
|
|||
WorkspaceTrashOperation operation,
|
||||
AsyncCallback<TrashOperationResult> callback);
|
||||
|
||||
void getACLsDescriptionForFolderId(String folderId,
|
||||
void getACLsDescriptionForSharedFolderId(String folderId,
|
||||
AsyncCallback<String> callback);
|
||||
|
||||
}
|
||||
|
|
|
@ -323,7 +323,7 @@ public class DialogGetInfo extends Dialog {
|
|||
|
||||
htmlUsersWidget.mask();
|
||||
|
||||
AppControllerExplorer.rpcWorkspaceService.getACLsDescriptionForFolderId(sharedId, new AsyncCallback<String>() {
|
||||
AppControllerExplorer.rpcWorkspaceService.getACLsDescriptionForSharedFolderId(sharedId, new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
|
|
@ -2579,33 +2579,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
public List<WorkspaceACL> getUserACLForFolderId(String folderId) throws Exception{
|
||||
try {
|
||||
|
||||
if(folderId == null)
|
||||
throw new Exception("Folder id is null");
|
||||
|
||||
workspaceLogger.trace("Get ACLByFolderId folder id: "+folderId);
|
||||
|
||||
Workspace workspace = getWorkspace();
|
||||
WorkspaceItem wsItem = workspace.getItem(folderId);
|
||||
|
||||
if(wsItem.isShared() && (wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER))){
|
||||
workspaceLogger.trace("Get ACLByFolderId folder id is shared folder");
|
||||
WorkspaceSharedFolder ite = (WorkspaceSharedFolder) workspace.getItemByPath(wsItem.getPath());
|
||||
|
||||
if(ite.getIdSharedFolder()!=null && ite.getId().compareTo(ite.getIdSharedFolder())!=0){//IS SHARED FOLDER IS NOT BASE
|
||||
ite = (WorkspaceSharedFolder) workspace.getItem(ite.getIdSharedFolder());
|
||||
}
|
||||
workspaceLogger.trace("Get ACLByFolderId shared folder name is: "+ite.getName());
|
||||
|
||||
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
||||
|
||||
//DEBUG //TODO REMOVE THIS FOR PRODUCTION
|
||||
workspaceLogger.trace("Get ACLByFolderId ACL user returned is : "+ite.getACLUser());
|
||||
return builder.getWorkspaceACLFromACLs(Arrays.asList(ite.getACLUser()));
|
||||
|
||||
}else{
|
||||
workspaceLogger.trace("Source item is not shared or shared folder, throw exceptio");
|
||||
throw new Exception("Source item is not shared or shared folder");
|
||||
}
|
||||
WorkspaceSharedFolder wsFolder = getSharedFolderForId(folderId);
|
||||
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
||||
return builder.getWorkspaceACLFromACLs(Arrays.asList(wsFolder.getACLUser()));
|
||||
} catch (Exception e) {
|
||||
workspaceLogger.error("Error in server get getACLForFolderId", e);
|
||||
String error = ConstantsExplorer.SERVER_ERROR +" get ACL rules for selected folder. "+e.getMessage();
|
||||
|
@ -2619,35 +2595,12 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public String getACLsDescriptionForFolderId(String folderId) throws Exception{
|
||||
public String getACLsDescriptionForSharedFolderId(String folderId) throws Exception{
|
||||
try {
|
||||
|
||||
if(folderId == null)
|
||||
throw new Exception("Folder id is null");
|
||||
|
||||
workspaceLogger.trace("Get ACLsDescriptionForFolderId folder id: "+folderId);
|
||||
|
||||
Workspace workspace = getWorkspace();
|
||||
WorkspaceItem wsItem = workspace.getItem(folderId);
|
||||
|
||||
if(wsItem.isShared() && (wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER))){
|
||||
workspaceLogger.trace("Get ACLsDescriptionForFolderId folder id is shared folder");
|
||||
WorkspaceSharedFolder ite = (WorkspaceSharedFolder) workspace.getItemByPath(wsItem.getPath());
|
||||
|
||||
if(ite.getIdSharedFolder()!=null && ite.getId().compareTo(ite.getIdSharedFolder())!=0){//IS SHARED FOLDER IS NOT BASE
|
||||
ite = (WorkspaceSharedFolder) workspace.getItem(ite.getIdSharedFolder());
|
||||
}
|
||||
|
||||
workspaceLogger.trace("Get ACLsDescriptionForFolderId shared folder name is: "+ite.getName());
|
||||
|
||||
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
||||
|
||||
return builder.getFormattedHtmlACLFromACLs(ite.getACLOwner());
|
||||
|
||||
}else{
|
||||
workspaceLogger.trace("Source item is not shared or shared folder, throw exceptio");
|
||||
throw new Exception("Source item is not shared or shared folder");
|
||||
}
|
||||
WorkspaceSharedFolder wsFolder = getSharedFolderForId(folderId);
|
||||
GWTWorkspaceBuilder builder = getGWTWorkspaceBuilder();
|
||||
return builder.getFormattedHtmlACLFromACLs(wsFolder.getACLOwner());
|
||||
} catch (Exception e) {
|
||||
workspaceLogger.error("Error in server get getACLForFolderId", e);
|
||||
String error = ConstantsExplorer.SERVER_ERROR +" get ACL rules for selected folder. "+e.getMessage();
|
||||
|
@ -2656,6 +2609,35 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
|||
}
|
||||
|
||||
|
||||
private WorkspaceSharedFolder getSharedFolderForId(String folderId) throws Exception{
|
||||
|
||||
if(folderId == null)
|
||||
throw new Exception("Folder id is null");
|
||||
|
||||
workspaceLogger.trace("Get ACLsDescriptionForFolderId folder id: "+folderId);
|
||||
|
||||
Workspace workspace = getWorkspace();
|
||||
WorkspaceItem wsItem = workspace.getItem(folderId);
|
||||
|
||||
if(wsItem!=null && wsItem.isShared()){
|
||||
workspaceLogger.trace("Get SharedFolderForId: folder id "+folderId+" is shared");
|
||||
WorkspaceSharedFolder wsFolder = (WorkspaceSharedFolder) workspace.getItem(wsItem.getIdSharedFolder());
|
||||
|
||||
if(wsFolder!=null){
|
||||
workspaceLogger.trace("Get ACLsDescriptionForFolderId shared folder name is: "+wsFolder.getName());
|
||||
return wsFolder;
|
||||
|
||||
}else{
|
||||
workspaceLogger.trace("Source item is not a shared folder, throw exception");
|
||||
throw new Exception("Source item is not a shared folder");
|
||||
}
|
||||
}else{
|
||||
workspaceLogger.trace("Source item is null or not shared, throw exception");
|
||||
throw new Exception("Source item is null or not shared");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -77,10 +77,10 @@ public class WsUtil {
|
|||
|
||||
/*USE ANOTHER ACCOUNT (OTHERWHISE BY TEST_USER) FOR RUNNING
|
||||
* COMMENT THIS IN DEVELOP ENVIROMENT (UNCOMMENT IN PRODUCTION)*/
|
||||
user=TEST_USER;
|
||||
// user=TEST_USER;
|
||||
|
||||
//UNCOMMENT THIS IN DEVELOP ENVIROMENT
|
||||
// user = "francesco.mangiacrapa";
|
||||
user = "francesco.mangiacrapa";
|
||||
|
||||
logger.warn("WORKSPACE PORTLET STARTING IN TEST MODE - NO USER FOUND - PORTLETS STARTING WITH FOLLOWING SETTINGS:");
|
||||
logger.warn("session id: "+sessionID);
|
||||
|
@ -108,10 +108,10 @@ public class WsUtil {
|
|||
withoutPortal = true;
|
||||
|
||||
//COMMENT THIS IN PRODUCTION ENVIROMENT
|
||||
// }else if(user.compareToIgnoreCase("francesco.mangiacrapa")==0){
|
||||
//
|
||||
// withoutPortal = true;
|
||||
//// END UNCOMMENT
|
||||
}else if(user.compareToIgnoreCase("francesco.mangiacrapa")==0){
|
||||
|
||||
withoutPortal = true;
|
||||
// END UNCOMMENT
|
||||
}else{
|
||||
|
||||
withoutPortal = false;
|
||||
|
|
Loading…
Reference in New Issue