fix for the root organization
git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/widgets/ckan-metadata-publisher-widget@130668 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
69c045c221
commit
7e21e3407b
|
@ -15,6 +15,7 @@ import org.gcube.common.homelibrary.home.workspace.folder.FolderItem;
|
|||
import org.gcube.common.homelibrary.home.workspace.folder.items.GCubeItem;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.datacatalogue.ckanutillibrary.CKanUtils;
|
||||
import org.gcube.datacatalogue.ckanutillibrary.CKanUtilsImpl;
|
||||
import org.gcube.datacatalogue.ckanutillibrary.models.RolesIntoOrganization;
|
||||
import org.gcube.datacatalogue.metadatadiscovery.DataCalogueMetadataFormatReader;
|
||||
import org.gcube.datacatalogue.metadatadiscovery.bean.MetadataType;
|
||||
|
@ -248,7 +249,7 @@ public class Utils {
|
|||
// get the orgs of the user
|
||||
List<CkanOrganization> ckanOrgs = ckanUtils.getOrganizationsByUser(username);
|
||||
for (CkanOrganization ckanOrganization : ckanOrgs) {
|
||||
if(ckanOrganization.getName().equals(gCubeGroupName.toLowerCase())){
|
||||
if(ckanOrganization.getName().equals(gCubeGroupName.toLowerCase()) || ckanOrganization.getName().equals(CKanUtilsImpl.PRODUCTION_CKAN_ORGNAME_ROOT)){
|
||||
orgs.add(new OrganizationBean(ckanOrganization.getTitle(), ckanOrganization.getName()));
|
||||
break;
|
||||
}
|
||||
|
@ -283,6 +284,10 @@ public class Utils {
|
|||
|
||||
logger.debug("Organization name is " + organizationName);
|
||||
|
||||
// TODO check for the root
|
||||
if(organizationName.equals(CKanUtilsImpl.PRODUCTION_CKAN_ORGNAME_ROOT))
|
||||
return CKanUtilsImpl.PRODUCTION_SCOPE_ROOT;
|
||||
|
||||
GroupManager gm = new LiferayGroupManager();
|
||||
List<GCubeGroup> groups = gm.listGroups();
|
||||
for (GCubeGroup gCubeGroup : groups) {
|
||||
|
@ -300,6 +305,11 @@ public class Utils {
|
|||
public static String getOrganizationNameFromScope(String scope) throws Exception {
|
||||
|
||||
if(scope != null){
|
||||
|
||||
// TODO check for the root
|
||||
if(scope.equals(CKanUtilsImpl.PRODUCTION_SCOPE_ROOT))
|
||||
return CKanUtilsImpl.PRODUCTION_CKAN_ORGNAME_ROOT;
|
||||
|
||||
GroupManager gm = new LiferayGroupManager();
|
||||
return gm.getGroup(gm.getGroupIdFromInfrastructureScope(scope)).getGroupName().toLowerCase();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue