|
|
|
@ -17,7 +17,7 @@ import javax.servlet.http.HttpSession;
|
|
|
|
|
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue;
|
|
|
|
|
import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogueFactory;
|
|
|
|
|
import org.gcube.datacatalogue.ckanutillibrary.server.utils.SessionCatalogueAttributes;
|
|
|
|
|
import org.gcube.datacatalogue.ckanutillibrary.server.utils.UtilMethods;
|
|
|
|
|
import org.gcube.datacatalogue.ckanutillibrary.server.utils.CatalogueUtilMethods;
|
|
|
|
|
import org.gcube.datacatalogue.ckanutillibrary.shared.ResourceBean;
|
|
|
|
|
import org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg;
|
|
|
|
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherService;
|
|
|
|
@ -101,7 +101,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|
|
|
|
List<OrganizationBean> orgsName = new ArrayList<OrganizationBean>();
|
|
|
|
|
|
|
|
|
|
HttpSession httpSession = getThreadLocalRequest().getSession();
|
|
|
|
|
String keyPerScope = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_ORGANIZATIONS_PUBLISH_KEY, scope);
|
|
|
|
|
String keyPerScope = CatalogueUtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_ORGANIZATIONS_PUBLISH_KEY, scope);
|
|
|
|
|
|
|
|
|
|
if(httpSession.getAttribute(keyPerScope) != null){
|
|
|
|
|
orgsName = (List<OrganizationBean>)httpSession.getAttribute(keyPerScope);
|
|
|
|
@ -151,7 +151,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|
|
|
|
HttpSession httpSession = getThreadLocalRequest().getSession();
|
|
|
|
|
String scope = GenericUtils.getScopeFromClientUrl(getThreadLocalRequest());
|
|
|
|
|
logger.info("Request for CKAN licenses for scope " + scope);
|
|
|
|
|
String keyPerScope = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_LICENSES_KEY, scope);
|
|
|
|
|
String keyPerScope = CatalogueUtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_LICENSES_KEY, scope);
|
|
|
|
|
|
|
|
|
|
List<LicenseBean> licensesBean = null;
|
|
|
|
|
if(httpSession.getAttribute(keyPerScope) != null){
|
|
|
|
@ -264,7 +264,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|
|
|
|
private List<String> discoverTagsVocabulary(String context){
|
|
|
|
|
|
|
|
|
|
logger.debug("Looking for vocabulary of tags in this context " + context);
|
|
|
|
|
String keyPerVocabulary = UtilMethods.concatenateSessionKeyScope(TAGS_VOCABULARY_KEY, context);
|
|
|
|
|
String keyPerVocabulary = CatalogueUtilMethods.concatenateSessionKeyScope(TAGS_VOCABULARY_KEY, context);
|
|
|
|
|
|
|
|
|
|
List<String> vocabulary = (List<String>) getThreadLocalRequest().getSession().getAttribute(keyPerVocabulary);
|
|
|
|
|
if(vocabulary == null){
|
|
|
|
@ -483,7 +483,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|
|
|
|
return true; // it's an error somehow
|
|
|
|
|
try{
|
|
|
|
|
String scopeFromOrgName = getScopeFromOrgName(orgName);
|
|
|
|
|
String idFromTitle = UtilMethods.fromProductTitleToName(title);
|
|
|
|
|
String idFromTitle = CatalogueUtilMethods.fromProductTitleToName(title);
|
|
|
|
|
logger.debug("Evaluating if dataset with id " + title + " in context " + scopeFromOrgName + " already exists");
|
|
|
|
|
return getCatalogue(scopeFromOrgName).existProductWithNameOrId(idFromTitle);
|
|
|
|
|
}catch(Exception e){
|
|
|
|
@ -539,7 +539,7 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|
|
|
|
String scope = orgName != null ? getScopeFromOrgName(orgName) : GenericUtils.getScopeFromClientUrl(getThreadLocalRequest());
|
|
|
|
|
|
|
|
|
|
// check if they are in session
|
|
|
|
|
String keyPerScopeGroups = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_GROUPS_MEMBER, scope);
|
|
|
|
|
String keyPerScopeGroups = CatalogueUtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_GROUPS_MEMBER, scope);
|
|
|
|
|
|
|
|
|
|
if(httpSession.getAttribute(keyPerScopeGroups) != null){
|
|
|
|
|
toReturn = (List<OrganizationBean>)httpSession.getAttribute(keyPerScopeGroups);
|
|
|
|
@ -585,9 +585,9 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C
|
|
|
|
|
String scopePerCurrentUrl = GenericUtils.getScopeFromClientUrl(getThreadLocalRequest());
|
|
|
|
|
|
|
|
|
|
// get key per scope
|
|
|
|
|
String keyPerScopeRole = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_HIGHEST_ROLE, scopePerCurrentUrl);
|
|
|
|
|
String keyPerScopeOrganizations = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_ORGANIZATIONS_PUBLISH_KEY, scopePerCurrentUrl);
|
|
|
|
|
String keyPerScopeGroups = UtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_GROUPS_MEMBER, scopePerCurrentUrl);
|
|
|
|
|
String keyPerScopeRole = CatalogueUtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_HIGHEST_ROLE, scopePerCurrentUrl);
|
|
|
|
|
String keyPerScopeOrganizations = CatalogueUtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_ORGANIZATIONS_PUBLISH_KEY, scopePerCurrentUrl);
|
|
|
|
|
String keyPerScopeGroups = CatalogueUtilMethods.concatenateSessionKeyScope(SessionCatalogueAttributes.CKAN_GROUPS_MEMBER, scopePerCurrentUrl);
|
|
|
|
|
|
|
|
|
|
// check if this information was already into session(true means the user has at least in one org
|
|
|
|
|
// the role editor), false that he is just a member so he cannot publish
|
|
|
|
|