diff --git a/src/main/java/org/gcube/portlets/user/workspace/server/util/UserUtil.java b/src/main/java/org/gcube/portlets/user/workspace/server/util/UserUtil.java index 034c6c4..331ff76 100644 --- a/src/main/java/org/gcube/portlets/user/workspace/server/util/UserUtil.java +++ b/src/main/java/org/gcube/portlets/user/workspace/server/util/UserUtil.java @@ -27,11 +27,12 @@ import org.gcube.vomanagement.usermanagement.model.GatewayRolesNames; import eu.trentorise.opendata.jackan.model.CkanOrganization; + /** * The Class UserUtil. * * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it - * Nov 17, 2015 + * Sep 14, 2016 */ public class UserUtil { @@ -46,9 +47,6 @@ public class UserUtil { * @return the user full name if is available, the input parameter portalLogin otherwise */ public static String getUserFullName(String portalLogin){ - // return user.getPortalLogin(); //for testing in eclipse - - // logger.trace("Finding full name for: "+portalLogin); if(portalLogin==null) return ""; @@ -58,26 +56,22 @@ public class UserUtil { GCubeUser curr = null; try { - try { - curr = um.getUserByScreenName(portalLogin); - } catch (UserManagementSystemException e) { + curr = um.getUserByScreenName(portalLogin); - logger.error("UserManagementSystemException, during getting fullname for: "+portalLogin); - } catch (UserRetrievalFault e) { - - logger.error("UserRetrievalFault, during getting fullname for: "+portalLogin); - } + } catch (UserManagementSystemException e) { + logger.error("UserManagementSystemException, during getting fullname for: "+portalLogin); + } catch (UserRetrievalFault e) { + logger.error("UserRetrievalFault, during getting fullname for: "+portalLogin); }catch (Exception e) { logger.error("An error occurred in getUserFullName "+e,e); logger.warn("Return portal login "+portalLogin); return portalLogin; } - if (curr != null){ - // logger.trace("Return "+curr.getFullname() +" full name for: "+portalLogin); + if (curr != null) return curr.getFullname(); - } + }else{ logger.trace("DEVELOPEMENT MODE ON"); logger.trace("Returning input login: "+portalLogin); @@ -169,13 +163,14 @@ public class UserUtil { } /** - * Retrieve the highest ckan role the user has and also retrieve the list of organizations (scopes) in which the user has the ckan-admin role + * Retrieve the highest ckan role the user has and also retrieve the list of organizations (scopes) in which the user has the ckan-admin role. + * * @param currentScope the current scope * @param username the current username * @param groupName the current groupName - * @param gcubeCkanDataCatalogServiceImpl - * @param orgsInWhichAdminRole - * @param ckanUtils ckanUtils + * @param workspaceInstance the workspace instance + * @param orgsInWhichAdminRole the orgs in which admin role + * @return true, if successful */ public static boolean hasAdminRole(String currentScope, String username, String groupName, GWTWorkspaceServiceImpl workspaceInstance, List orgsInWhichAdminRole){ @@ -278,16 +273,17 @@ public class UserUtil { } /** - * Check if the role admin is set or must be set into the ckan instance at this scope - * @param username - * @param gCubeGroupName - * @param correspondentRoleToCheck - * @param workspaceInstance - * @param groupManager - * @param groupId - * @param orgsInWhichAdminRole - * @throws UserManagementSystemException - * @throws GroupRetrievalFault + * Check if the role admin is set or must be set into the ckan instance at this scope. + * + * @param username the username + * @param gCubeGroupName the g cube group name + * @param correspondentRoleToCheck the correspondent role to check + * @param workspaceInstance the workspace instance + * @param groupManager the group manager + * @param groupId the group id + * @param orgsInWhichAdminRole the orgs in which admin role + * @throws UserManagementSystemException the user management system exception + * @throws GroupRetrievalFault the group retrieval fault */ private static void checkIfRoleIsSetInCkanInstance(String username, String gCubeGroupName, @@ -318,9 +314,10 @@ public class UserUtil { } /** - * Retrieve the ckan roles among a list of liferay roles - * @param roles - * @return + * Retrieve the ckan roles among a list of liferay roles. + * + * @param roles the roles + * @return the liferay highest role in org */ private static RolesIntoOrganization getLiferayHighestRoleInOrg( List roles) {