minor fix when checking roles

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@131761 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-09-23 16:42:24 +00:00
parent 228f4b4193
commit d81fa0499f
1 changed files with 11 additions and 11 deletions

View File

@ -125,8 +125,8 @@ public class UserUtil {
RolesIntoOrganization correspondentRoleToCheck = getLiferayHighestRoleInOrg(roles);
// if the role is member, continue
if(correspondentRoleToCheck.equals(RolesIntoOrganization.MEMBER))
continue;
//if(correspondentRoleToCheck.equals(RolesIntoOrganization.MEMBER))
//continue;
// admin or editor case
checkIfRoleIsSetInCkanInstance(username, gCubeGroupName, gCubeGroup.getGroupId(),
@ -159,8 +159,8 @@ public class UserUtil {
RolesIntoOrganization correspondentRoleToCheck = getLiferayHighestRoleInOrg(roles);
// if the role is member, continue
if(correspondentRoleToCheck.equals(RolesIntoOrganization.MEMBER))
continue;
//if(correspondentRoleToCheck.equals(RolesIntoOrganization.MEMBER))
//continue;
checkIfRoleIsSetInCkanInstance(username, gCubeGroupName, gCubeGroup.getGroupId(),
correspondentRoleToCheck, groupManager, gcubeCkanDataCatalogServiceImpl, orgsInWhichAtLeastEditorRole);
@ -182,13 +182,13 @@ public class UserUtil {
RolesIntoOrganization correspondentRoleToCheck = getLiferayHighestRoleInOrg(roles);
//if it the role is ADMIN/EDITOR we have to be sure to set it
if(correspondentRoleToCheck.equals(RolesIntoOrganization.ADMIN) || correspondentRoleToCheck.equals(RolesIntoOrganization.EDITOR)){
//if(correspondentRoleToCheck.equals(RolesIntoOrganization.ADMIN) || correspondentRoleToCheck.equals(RolesIntoOrganization.EDITOR)){
checkIfRoleIsSetInCkanInstance(username, groupName, currentGroupId,
correspondentRoleToCheck, groupManager, gcubeCkanDataCatalogServiceImpl, orgsInWhichAtLeastEditorRole);
checkIfRoleIsSetInCkanInstance(username, groupName, currentGroupId,
correspondentRoleToCheck, groupManager, gcubeCkanDataCatalogServiceImpl, orgsInWhichAtLeastEditorRole);
toReturn = mapRolesIntoOrganizationToCkanRole(correspondentRoleToCheck);
}
toReturn = mapRolesIntoOrganizationToCkanRole(correspondentRoleToCheck);
//}
}
}catch(Exception e){
logger.error("Unable to retrieve the role information for this user. Returning member role", e);
@ -224,11 +224,11 @@ public class UserUtil {
// if there is an instance of ckan in this scope..
if(ckanUtils != null){
boolean res = ckanUtils.checkRole(username, gCubeGroupName, correspondentRoleToCheck);
if(res){
if(res && !correspondentRoleToCheck.equals(RolesIntoOrganization.MEMBER)){
// get the orgs of the user and retrieve its title and name
List<CkanOrganization> ckanOrgs = ckanUtils.getOrganizationsByUser(username);
for (CkanOrganization ckanOrganization : ckanOrgs) {
if(ckanOrganization.getName().equals(gCubeGroupName.toLowerCase())){// || ckanOrganization.getName().equals(CKanUtilsImpl.PRODUCTION_CKAN_ORGNAME_ROOT)){
if(ckanOrganization.getName().equals(gCubeGroupName.toLowerCase())){
orgsInWhichAtLeastEditorRole.add(new OrganizationBean(ckanOrganization.getTitle(), ckanOrganization.getName()));
break;
}