Bug fixing #22578. Moved to v6.34.1-SNAPSHOT

This commit is contained in:
Francesco Mangiacrapa 2021-12-20 14:41:43 +01:00
parent d4f64e35ed
commit 064009cea0
4 changed files with 24 additions and 11 deletions

View File

@ -4,6 +4,12 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v6.34.1-SNAPSHOT] - 2021-12-20
#### Fixes
- [#22578] GetInfo facility invoked by Tree View does not display properly the Owner field
## [v6.34.0] - 2021-11-05
#### Enhancements

View File

@ -11,7 +11,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace-tree-widget</artifactId>
<version>6.34.0</version>
<version>6.34.1-SNAPSHOT</version>
<name>gCube Workspace Tree Widget</name>
<description>
gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace

View File

@ -79,7 +79,7 @@ public class ObjectStorageHubToWorkpaceMapper {
* @return the file model
* @throws InternalErrorException the internal error exception
*/
public static FileModel toTreeFileModelItem(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel parentFolderModel, boolean isParentShared) throws InternalErrorException{
public static FileModel toTreeFileModelItem(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel parentFolderModel, boolean isParentShared, GCubeUser loggedUser) throws InternalErrorException{
FileModel fileModel = null;
//boolean isPublic = false;
@ -145,6 +145,8 @@ public class ObjectStorageHubToWorkpaceMapper {
fileModel.setShareable(false);
}
setFullNameOwner(wrappedItem, fileModel, loggedUser);
//setSynchedThreddsStateFor(fileModel);
fileModel.setIsRoot(wrappedItem.isRoot());
logger.trace("Returning converted tree item: "+fileModel);
@ -247,27 +249,32 @@ public class ObjectStorageHubToWorkpaceMapper {
fileGridModel.setShareable(false); //UPDATED TO CHANGE PERMISSIONS TO SHARED SUBFOLDERS
}
setFullNameOwner(wrappedItem, fileGridModel, loggedUser);
logger.trace("Returning converted grid item: "+fileGridModel);
return fileGridModel;
}
private static void setFullNameOwner(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem, FileModel fileModel, GCubeUser loggedUser) {
//OWNER
if(wrappedItem.isShared()){ //IT IS READ FROM SHUB ONLY IF THE ITEM IS SHARED
fileGridModel.setShared(true); //NOT REMOVE IT IS IMPORTANT, SEE #1459
fileModel.setShared(true); //NOT REMOVE IT IS IMPORTANT, SEE #1459
String ownerUsername = wrappedItem.getOwner();
if(ownerUsername!=null){
// System.out.println("++++reading owner");
//String portalLogin = owner.getPortalLogin();
fileGridModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
fileModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
}
}
else{
String ownerUsername = wrappedItem.getOwner();
//Task #12911 I'm calling getUserFullName for any user other than logged user
if(ownerUsername!=null && ownerUsername.compareToIgnoreCase(loggedUser.getUsername())!=0){
fileGridModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
fileModel.setOwnerFullName(UserUtil.getUserFullName(ownerUsername));
}else
fileGridModel.setOwnerFullName(loggedUser.getFullname());
fileModel.setOwnerFullName(loggedUser.getFullname());
}
logger.trace("Returning converted grid item: "+fileGridModel);
return fileGridModel;
}

View File

@ -134,7 +134,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
public FileModel toTreeFileModel(org.gcube.common.storagehubwrapper.shared.tohl.WorkspaceItem wrappedItem,
FileModel parentFolderModel, Boolean isParentShared) throws InternalErrorException {
FileModel fileModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(wrappedItem, parentFolderModel, isParentShared);
FileModel fileModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(wrappedItem, parentFolderModel, isParentShared, loggedUser);
return setSynchedWithWsThredds(fileModel, wrappedItem);
}
@ -346,7 +346,7 @@ public class StorageHubToWorkpaceConverter implements Serializable {
.isPublicFolder(); // TODO
FileModel parentModel = null;
if (parent != null)
parentModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(parent, null, parent.isShared());
parentModel = ObjectStorageHubToWorkpaceMapper.toTreeFileModelItem(parent, null, parent.isShared(), loggedUser);
FolderModel folder = new FolderModel(wsFolder.getId(), name, parentModel, true, wsFolder.isShared(), false,
isPublicDir);