updated set ACLs

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@112128 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2015-02-16 14:36:11 +00:00
parent 1248407e63
commit 338f9ac8a0
1 changed files with 14 additions and 28 deletions

View File

@ -764,17 +764,9 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
//DEBUG
private void printContacts(List<InfoContactModel> listContacts){
boolean testMode = isTestMode();
if(testMode)
System.out.println("Contacts: ");
else
workspaceLogger.trace("Contacts:");
workspaceLogger.trace("Contacts:");
for (InfoContactModel infoContactModel : listContacts) {
if(testMode)
System.out.println("User: "+infoContactModel);
else
workspaceLogger.trace("User: "+infoContactModel);
}
}
@ -1986,19 +1978,11 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
+ " listContacts size: " + listContacts.size()
+" ACL: "+acl);
// //DEBUG
//System.out.println("shareFolder "+ folder.getIdentifier() + " name: "+ folder.getName() + " parent name: " + folder.getParentFileModel().getName() + " listContacts size: " + listContacts.size());
// for (InfoContactModel infoContactModel : listContacts) {
// System.out.println("share with "+ infoContactModel.getLogin());
// }
//DEBUG
printContacts(listContacts);
List<String> listLogin = UserUtil.getListLoginByInfoContactModel(listContacts);
WorkspaceSharedFolder sharedFolder = null;
List<InfoContactModel> listSharedContact = null;
boolean sourceFolderIsShared = folder.isShared();
@ -2036,10 +2020,7 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
if(!sourceFolderIsShared) //if source folder is not already shared
np.notifyFolderSharing(listContacts, sharedFolder);
else{
/*System.out.println("SHARED CONTACS: ");
printContacts(listSharedContact);
System.out.println("NEW CONTACS: ");
printContacts(listContacts);*/
// printContacts(listContacts);
np.notifyAddedUsersToSharing(listSharedContact, listContacts, sharedFolder);
}
}
@ -2703,21 +2684,26 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
Workspace workspace = getWorkspace();
WorkspaceItem wsItem = workspace.getItem(folderId);
//IS A WORKSPACE FOLDER?
if(wsItem!= null && wsItem.isFolder() && wsItem.isShared()){
WorkspaceSharedFolder ite;
WorkspaceFolder ite;
if(wsItem.getType().equals(WorkspaceItemType.SHARED_FOLDER)){
//IS ROOT SHARED FOLDER
ite = (WorkspaceSharedFolder) workspace.getItemByPath(wsItem.getPath());
ite = (WorkspaceSharedFolder) wsItem;
workspaceLogger.trace("Folder " +ite.getName()+" is a "+WorkspaceSharedFolder.class.getName());
// ite = (WorkspaceSharedFolder) workspace.getItemByPath(wsItem.getPath());
}else{
// IS SUB FOLDER OF THE SHARING
ite = (WorkspaceSharedFolder) workspace.getItem(wsItem.getIdSharedFolder());
// IS SUB FOLDER OF THE SHARING
ite = (WorkspaceFolder) wsItem;
workspaceLogger.trace("Folder " +ite.getName()+" is a "+WorkspaceFolder.class.getName());
// ite = (WorkspaceSharedFolder) workspace.getItem(wsItem.getIdSharedFolder());
}
ite.setACL(listLogins, ACLType.valueOf(aclType));
}else
throw new Exception("Source item is not shared or shared folder");
workspaceLogger.trace("Setting ACL completed, retuning");
workspaceLogger.info("Setting ACL for "+wsItem.getName()+" completed, returning");
} catch (Exception e) {
workspaceLogger.error("Error in set ACLs", e);
String error = ConstantsExplorer.SERVER_ERROR +" setting permissions. "+e.getMessage();