enhancements on Edit Permissions

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@111514 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-01-28 16:42:12 +00:00
parent dc503adf6e
commit 5e194f7591
2 changed files with 55 additions and 3 deletions

View File

@ -176,7 +176,7 @@ public class DialogGetInfo extends Dialog {
add(textAreaSharedWith); add(textAreaSharedWith);
*/ */
// htmlUsersWidget.setStyleAttribute("border", "1px solid #B5B8C8"); // htmlUsersWidget.setStyleAttribute("border", "1px solid #B5B8C8");
loadListSharedContacts(fileModel.getIdentifier()); loadACLsDescriptionForSharedFolder(fileModel.getIdentifier());
htmlUsersWidget.setHeight(heightTextArea); htmlUsersWidget.setHeight(heightTextArea);
htmlUsersWidget.setWidth("297px"); htmlUsersWidget.setWidth("297px");
hp.add(htmlUsersWidget); hp.add(htmlUsersWidget);
@ -356,7 +356,7 @@ public class DialogGetInfo extends Dialog {
// }); // });
// } // }
private void loadListSharedContacts(String sharedId){ private void loadACLsDescriptionForSharedFolder(String sharedId){
htmlUsersWidget.mask(); htmlUsersWidget.mask();

View File

@ -2898,8 +2898,10 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace(); Workspace workspace = getWorkspace();
WorkspaceItem wsItem = workspace.getItem(folderId); WorkspaceItem wsItem = workspace.getItem(folderId);
if(wsItem!=null && wsItem.isShared()){ if(isASharedFolder(wsItem, false)){
workspaceLogger.trace("Get SharedFolderForId: folder id "+folderId+" is shared"); workspaceLogger.trace("Get SharedFolderForId: folder id "+folderId+" is shared");
//TODO REMOVE wsItem.getIdSharedFolder()
WorkspaceSharedFolder wsFolder = (WorkspaceSharedFolder) workspace.getItem(wsItem.getIdSharedFolder()); WorkspaceSharedFolder wsFolder = (WorkspaceSharedFolder) workspace.getItem(wsItem.getIdSharedFolder());
if(wsFolder!=null){ if(wsFolder!=null){
@ -2910,12 +2912,62 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
workspaceLogger.trace("Source item is not a shared folder, throw exception"); workspaceLogger.trace("Source item is not a shared folder, throw exception");
throw new Exception("Source item is not a shared folder"); throw new Exception("Source item is not a shared folder");
} }
//TODO USE THIS
// return (WorkspaceFolder) wsItem;
}else{ }else{
workspaceLogger.trace("Source item is null or not shared, throw exception"); workspaceLogger.trace("Source item is null or not shared, throw exception");
throw new Exception("Source item is null or not shared"); throw new Exception("Source item is null or not shared");
} }
} }
/**
*
* @param itemID
* @param asRoot true check if itemID is root, not otherwise
* @return
*/
public boolean isASharedFolder(String itemID, boolean asRoot){
try {
if(itemID==null)
throw new Exception("ItemId is null");
Workspace workspace = getWorkspace();
WorkspaceItem item = workspace.getItem(itemID);
return isASharedFolder(item, asRoot);
}catch(Exception e){
workspaceLogger.error("Error in server isASharedFolder", e);
return false;
}
}
/**
* @see #isASharedFolder(String, boolean)
* @param item
* @param asRoot
* @return
*/
public boolean isASharedFolder(WorkspaceItem item, boolean asRoot){
try {
if(item!=null && item.isFolder() && item.isShared()){ //IS A SHARED SUB-FOLDER
if(asRoot)
return item.getType().equals(WorkspaceItemType.SHARED_FOLDER); //IS ROOT?
return true;
}
return false;
}catch(Exception e){
workspaceLogger.error("Error in server isASharedFolder", e);
return false;
}
}
/** /**