Restored moderation link

This commit is contained in:
Luca Frosini 2022-07-26 11:18:21 +02:00
parent d40dcc2f95
commit 7f3bbdd1ca
3 changed files with 38 additions and 29 deletions

View File

@ -2,6 +2,11 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
# Changelog for gCube Catalogue (gCat) Service # Changelog for gCube Catalogue (gCat) Service
## [v2.4.0-SNAPSHOT]
- Added moderation link in moderation message [#23142]
## [v2.3.0] ## [v2.3.0]
- Switched moderation messages to notification [#23317] - Switched moderation messages to notification [#23317]

View File

@ -12,7 +12,7 @@
<groupId>org.gcube.data-catalogue</groupId> <groupId>org.gcube.data-catalogue</groupId>
<artifactId>gcat</artifactId> <artifactId>gcat</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>2.3.0</version> <version>2.4.0-SNAPSHOT</version>
<name>gCube Catalogue (gCat) Service</name> <name>gCube Catalogue (gCat) Service</name>
<description> <description>
This service allows any client to publish on the gCube Catalogue. This service allows any client to publish on the gCube Catalogue.

View File

@ -1,9 +1,15 @@
package org.gcube.gcat.moderation.thread; package org.gcube.gcat.moderation.thread;
import java.util.HashMap;
import java.util.Map;
//import java.util.HashMap; //import java.util.HashMap;
//import java.util.Map; //import java.util.Map;
import org.gcube.com.fasterxml.jackson.databind.ObjectMapper; import org.gcube.com.fasterxml.jackson.databind.ObjectMapper;
import org.gcube.common.authorization.utils.manager.SecretManager;
import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
import org.gcube.gcat.api.configuration.CatalogueConfiguration;
//import org.gcube.common.authorization.utils.manager.SecretManager; //import org.gcube.common.authorization.utils.manager.SecretManager;
//import org.gcube.common.authorization.utils.manager.SecretManagerProvider; //import org.gcube.common.authorization.utils.manager.SecretManagerProvider;
//import org.gcube.gcat.api.configuration.CatalogueConfiguration; //import org.gcube.gcat.api.configuration.CatalogueConfiguration;
@ -13,6 +19,9 @@ import org.gcube.gcat.persistence.ckan.CKANUser;
//import org.gcube.portlets.user.uriresolvermanager.UriResolverManager; //import org.gcube.portlets.user.uriresolvermanager.UriResolverManager;
//import org.gcube.portlets.user.uriresolvermanager.resolvers.query.CatalogueResolverQueryString.MODERATION_OP; //import org.gcube.portlets.user.uriresolvermanager.resolvers.query.CatalogueResolverQueryString.MODERATION_OP;
//import org.gcube.portlets.user.uriresolvermanager.resolvers.query.CatalogueResolverQueryStringBuilder; //import org.gcube.portlets.user.uriresolvermanager.resolvers.query.CatalogueResolverQueryStringBuilder;
import org.gcube.portlets.user.uriresolvermanager.UriResolverManager;
import org.gcube.portlets.user.uriresolvermanager.resolvers.query.CatalogueResolverQueryString.MODERATION_OP;
import org.gcube.portlets.user.uriresolvermanager.resolvers.query.CatalogueResolverQueryStringBuilder;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
@ -62,35 +71,30 @@ public abstract class ModerationThread {
} }
public String getModerationURL() { public String getModerationURL() {
// if(moderationURL==null) {
// TODO Add the following change in changelog try {
// - Added moderation link in moderation message [#23142] SecretManager secretManager = SecretManagerProvider.instance.get();
// String context = secretManager.getContext();
// if(moderationURL==null) { UriResolverManager resolver = new UriResolverManager("CTLG");
// try { Map<String, String> params = new HashMap<String, String>();
// SecretManager secretManager = SecretManagerProvider.instance.get(); params.put("gcube_scope", context); //e.g. /gcube/devsec/devVRE
// String context = secretManager.getContext(); params.put("entity_context", "organization");
// UriResolverManager resolver = new UriResolverManager("CTLG"); params.put("entity_name", CatalogueConfiguration.getOrganizationName(context)); //e.g. devvre
// Map<String, String> params = new HashMap<String, String>();
// params.put("gcube_scope", context); //e.g. /gcube/devsec/devVRE CatalogueResolverQueryStringBuilder builder = new CatalogueResolverQueryStringBuilder(itemName); //item name under moderation
// params.put("entity_context", "organization"); builder.itemStatus(cmItemStatus.name()). //e.g. pending, approved, rejected
// params.put("entity_name", CatalogueConfiguration.getOrganizationName(context)); //e.g. devvre moderation(MODERATION_OP.show);
//
// CatalogueResolverQueryStringBuilder builder = new CatalogueResolverQueryStringBuilder(itemName); //item name under moderation String queryString = builder.buildQueryParametersToQueryString();
// builder.itemStatus(cmItemStatus.name()). //e.g. pending, approved, rejected params.put(CatalogueResolverQueryStringBuilder.QUERY_STRING_PARAMETER, queryString);
// moderation(MODERATION_OP.show);
// moderationURL = resolver.getLink(params, true);
// String queryString = builder.buildQueryParametersToQueryString(); }catch (Exception e) {
// params.put(CatalogueResolverQueryStringBuilder.QUERY_STRING_PARAMETER, queryString);
//
// moderationURL = resolver.getLink(params, true);
// }catch (Exception e) {
// return itemURL;
// }
// }
// return moderationURL;
return itemURL; return itemURL;
} }
}
return moderationURL;
}
/** /**
* The message is sent as gCat * The message is sent as gCat