minor fix when checking roles

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@131764 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-09-23 16:48:43 +00:00
parent d7884b6ad2
commit 24565db7ff
1 changed files with 4 additions and 16 deletions

View File

@ -208,10 +208,6 @@ public class UserUtil {
// get highest role
RolesIntoOrganization correspondentRoleToCheck = getLiferayHighestRoleInOrg(roles);
// if the role is member, continue
if(correspondentRoleToCheck.equals(RolesIntoOrganization.MEMBER))
continue;
checkIfRoleIsSetInCkanInstance(username, gCubeGroupName, correspondentRoleToCheck, workspaceInstance,
groupManager, gCubeGroup.getGroupId(), orgsInWhichAtLeastEditorRole);
}
@ -233,10 +229,6 @@ public class UserUtil {
// get highest role
RolesIntoOrganization correspondentRoleToCheck = getLiferayHighestRoleInOrg(roles);
// if the role is member, continue
if(correspondentRoleToCheck.equals(RolesIntoOrganization.MEMBER))
continue;
checkIfRoleIsSetInCkanInstance(username, gCubeGroupName, correspondentRoleToCheck, workspaceInstance,
groupManager, gCubeGroup.getGroupId(), orgsInWhichAtLeastEditorRole);
}
@ -249,12 +241,8 @@ public class UserUtil {
// get highest role
RolesIntoOrganization correspondentRoleToCheck = getLiferayHighestRoleInOrg(roles);
// if it the role is ADMIN we have to be sure to set it
if(correspondentRoleToCheck.equals(RolesIntoOrganization.ADMIN)){
checkIfRoleIsSetInCkanInstance(username, groupName, correspondentRoleToCheck, workspaceInstance,
groupManager, currentGroupId, orgsInWhichAtLeastEditorRole);
}
checkIfRoleIsSetInCkanInstance(username, groupName, correspondentRoleToCheck, workspaceInstance,
groupManager, currentGroupId, orgsInWhichAtLeastEditorRole);
}
}catch(Exception e){
logger.error("Unable to retrieve the role information for this user. Returning false", e);
@ -295,8 +283,8 @@ 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
List<CkanOrganization> ckanOrgs = ckanUtils.getOrganizationsByUser(username);
for (CkanOrganization ckanOrganization : ckanOrgs) {