|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package org.gcube.portlets.widgets.ckandatapublisherwidget.server.utils;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
|
|
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue;
|
|
|
|
|
import org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg;
|
|
|
|
@ -39,7 +40,7 @@ public class CatalogueRoleManager {
|
|
|
|
|
* @param orgsInWhichAtLeastEditorRole
|
|
|
|
|
* @return the highest among the roles
|
|
|
|
|
*/
|
|
|
|
|
public static RolesCkanGroupOrOrg getHighestRole(String currentScope, String username, String groupName, CKANPublisherServicesImpl gcubeCkanDataCatalogServiceImpl, List<OrganizationBean> orgsInWhichAtLeastEditorRole){
|
|
|
|
|
public static RolesCkanGroupOrOrg getHighestRole(String currentScope, String username, String groupName, CKANPublisherServicesImpl gcubeCkanDataCatalogServiceImpl, List<OrganizationBean> orgsInWhichAtLeastEditorRole, String gatewayHostname){
|
|
|
|
|
|
|
|
|
|
// base role as default value
|
|
|
|
|
RolesCkanGroupOrOrg toReturn = RolesCkanGroupOrOrg.MEMBER;
|
|
|
|
@ -59,7 +60,14 @@ public class CatalogueRoleManager {
|
|
|
|
|
logger.debug("Group id is " + currentGroupId + " and scope is " + currentScope);
|
|
|
|
|
|
|
|
|
|
// retrieve the flat list of organizations for the current user
|
|
|
|
|
List<GCubeGroup> groups = groupManager.listGroupsByUser(userid);
|
|
|
|
|
//List<GCubeGroup> groups = groupManager.listGroupsByUser(userid);
|
|
|
|
|
|
|
|
|
|
// retrieve the list of organizations for the current user filtered for gateway
|
|
|
|
|
Set<GCubeGroup> groups = groupManager.listGroupsByUserAndSite(userid, gatewayHostname);
|
|
|
|
|
|
|
|
|
|
for (GCubeGroup gCubeGroup : groups) {
|
|
|
|
|
logger.info("Found group filter per "+gatewayHostname+": "+gCubeGroup.toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// root (so check into the root, the VOs and the VRES)
|
|
|
|
|
if(groupManager.isRootVO(currentGroupId)){
|
|
|
|
|