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