minor fix

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@130556 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-07-19 15:14:12 +00:00
parent 5577c0715e
commit 82fed8eb45
2 changed files with 4 additions and 5 deletions

View File

@ -310,12 +310,12 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
logger.info("Set role " + toReturn + " into session for user " + username);
}
// if he is not a member (so he can publish), preload:
// if he is not a member/editor (so he can publish), preload:
// 1) organizations in which he can publish
// 2) the list of licenses
// 3) metadata profiles
// In this way the publish widget can simply retrieve those information from the ASL session
if(!toReturn.equals(CkanRole.MEMBER)){
if(!(toReturn.equals(CkanRole.MEMBER) || toReturn.equals(CkanRole.EDITOR))){
UserUtil.getLicenses(httpSession, username, concatenateSessionKeyScope(CKAN_LICENSES_KEY, currentScope), ckanUtils);
UserUtil.getUserOrganizationsList(httpSession, username, isSysAdmin, concatenateSessionKeyScope(CKAN_ORGANIZATIONS_PUBLISH_KEY, currentScope), ckanUtils, getUserCKanTokenFromSession());
UserUtil.getMetadataProfilesList(httpSession, username, concatenateSessionKeyScope(CKAN_PROFILES_KEY, currentScope), ckanUtils);

View File

@ -333,9 +333,8 @@ public class UserUtil {
}else{
// We need to retrieve orgs in which the user has the roles ADMIN or EDITOR
// We need to retrieve orgs in which the user has the roles ADMIN
List<RolesIntoOrganization> rolesToMatch = new ArrayList<RolesIntoOrganization>();
rolesToMatch.add(RolesIntoOrganization.EDITOR);
rolesToMatch.add(RolesIntoOrganization.ADMIN);
Map<String, List<RolesIntoOrganization>> orgsAndRoles = ckanUtils.getGroupsAndRolesByUser(username, rolesToMatch);
@ -347,7 +346,7 @@ public class UserUtil {
Map.Entry<String, List<RolesIntoOrganization>> entry = (Map.Entry<String, List<RolesIntoOrganization>>) iterator
.next();
orgsName.add(entry.getKey());
logger.debug("The user has a role ADMIN/EDITOR into org " + entry.getKey());
logger.debug("The user has a role ADMIN into org " + entry.getKey());
}
}
session.setAttribute(ckanOrganizationsPublishKey, orgsName);