minor fixes and improvements
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@130606 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
a788c64667
commit
224014aff7
|
@ -7,6 +7,9 @@
|
|||
<dependent-module archiveName="ckan-metadata-publisher-widget-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan-metadata-publisher-widget/ckan-metadata-publisher-widget">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<dependent-module archiveName="ckan-util-library-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan-util-library/ckan-util-library">
|
||||
<dependency-type>uses</dependency-type>
|
||||
</dependent-module>
|
||||
<property name="context-root" value="gcube-ckan-datacatalog"/>
|
||||
<property name="java-output-path" value="/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/>
|
||||
</wb-module>
|
||||
|
|
|
@ -289,7 +289,7 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
|
|||
if(httpSession.getAttribute(keyPerScope) != null){
|
||||
|
||||
toReturn = (CkanRole)httpSession.getAttribute(keyPerScope);
|
||||
logger.info("Found user role into session " + toReturn + " and it is going to be returned");
|
||||
logger.info("Found user role into session " + toReturn + " and it is going to be returned for user " + username);
|
||||
|
||||
}else{
|
||||
|
||||
|
|
|
@ -96,20 +96,20 @@ public class UserUtil {
|
|||
|
||||
logger.debug("Group id is " + currentGroupId + " and scope is " + currentScope);
|
||||
|
||||
// retrieve the flat list of organizations
|
||||
// retrieve the flat list of organizations for the current user
|
||||
List<GCubeGroup> groups = groupManager.listGroupsByUser(userid);
|
||||
|
||||
// root (so check into the root, the VOs and the VRES)
|
||||
if(groupManager.isRootVO(currentGroupId)){
|
||||
|
||||
logger.debug("The list of organizations of the user " + username + " is " + groups);
|
||||
logger.info("The current scope is the Root Vo, so the list of organizations of the user " + username + " is " + groups);
|
||||
|
||||
for (GCubeGroup gCubeGroup : groups) {
|
||||
|
||||
// get the name of this vre
|
||||
// get the name of this group
|
||||
String gCubeGroupName = gCubeGroup.getGroupName();
|
||||
|
||||
// get the role of the users in this vre
|
||||
// get the role of the users in this group
|
||||
List<GCubeRole> roles = roleManager.listRolesByUserAndGroup(userid, groupManager.getGroupId(gCubeGroupName));
|
||||
|
||||
// the default one
|
||||
|
@ -142,18 +142,17 @@ public class UserUtil {
|
|||
continue; // it is already the highest
|
||||
|
||||
}
|
||||
}
|
||||
}else
|
||||
logger.error("It seems there is no ckan instance into scope " + groupManager.getInfrastructureScope(gCubeGroup.getGroupId()));
|
||||
}
|
||||
|
||||
// set the role
|
||||
logger.debug("Setting role " + toReturn + " into session for user " + username);
|
||||
|
||||
}else if(groupManager.isVO(currentGroupId)){
|
||||
|
||||
logger.debug("The list of organizations of the user " + username + " is " + groups);
|
||||
logger.debug("The list of organizations of the user " + username + " to scan is the one under the VO " + groupName);
|
||||
|
||||
for (GCubeGroup gCubeGroup : groups) {
|
||||
|
||||
// if the gCubeGroup is not under the VO or it is not the VO continue
|
||||
if(currentGroupId != gCubeGroup.getParentGroupId() || currentGroupId != gCubeGroup.getGroupId())
|
||||
continue;
|
||||
|
||||
|
@ -192,16 +191,14 @@ public class UserUtil {
|
|||
continue; // it is already the highest
|
||||
|
||||
}
|
||||
}
|
||||
}else
|
||||
logger.error("It seems there is no ckan instance into scope " + groupManager.getInfrastructureScope(gCubeGroup.getGroupId()));
|
||||
}
|
||||
|
||||
// set the role
|
||||
logger.debug("Setting role " + toReturn + " into session for user " + username );
|
||||
|
||||
}else if(groupManager.isVRE(currentGroupId)){ // vre
|
||||
}else if(groupManager.isVRE(currentGroupId)){
|
||||
List<GCubeRole> roles = roleManager.listRolesByUserAndGroup(userManager.getUserId(username), groupManager.getGroupId(groupName));
|
||||
|
||||
logger.debug("The list of roles for " + username + " into " + groupName + " is " + roles);
|
||||
logger.debug("The current scope is the vre " + groupName);
|
||||
|
||||
// the default one
|
||||
String mainRole = "Catalogue-Member";
|
||||
|
@ -218,6 +215,7 @@ public class UserUtil {
|
|||
}
|
||||
}
|
||||
|
||||
// if it the role is ADMIN we have to be sure to set it
|
||||
if(correspondentRoleToCheck.equals(RolesIntoOrganization.ADMIN)){
|
||||
|
||||
// with this invocation, we check if the role is present in ckan and if it is not it will be added
|
||||
|
@ -237,6 +235,8 @@ public class UserUtil {
|
|||
toReturn = CkanRole.MEMBER;
|
||||
}
|
||||
|
||||
// return the role
|
||||
logger.debug("Returning role " + toReturn + " for user " + username);
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue