in progress integration with CMS

This commit is contained in:
Francesco Mangiacrapa 2022-02-17 17:01:25 +01:00
parent 788939f8b6
commit 8e2b30707b
13 changed files with 176 additions and 109 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" output="target/gcube-ckan-datacatalog-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java"> <classpathentry kind="src" output="target/gcube-ckan-datacatalog-2.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry excluding="**" kind="src" output="target/gcube-ckan-datacatalog-2.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources"> <classpathentry excluding="**" kind="src" output="target/gcube-ckan-datacatalog-2.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
@ -35,5 +35,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/gcube-ckan-datacatalog-2.1.0-SNAPSHOT/WEB-INF/classes"/> <classpathentry kind="output" path="target/gcube-ckan-datacatalog-2.2.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -1,6 +1,6 @@
>>>>>>>=refs/heads/task_20699 >>>>>>>=refs/heads/task_20699
eclipse.preferences.version=1 eclipse.preferences.version=1
jarsExcludedFromWebInfLib= jarsExcludedFromWebInfLib=
lastWarOutDir=/home/francescomangiacrapa/git/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-2.1.0-SNAPSHOT lastWarOutDir=/home/francescomangiacrapa/git/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-2.2.0-SNAPSHOT
warSrcDir=src/main/webapp warSrcDir=src/main/webapp
warSrcDirIsOutput=false warSrcDirIsOutput=false

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -13,8 +13,16 @@
<wb-module deploy-name="gcube-ckan-datacatalog-2.1.0-SNAPSHOT">
<wb-module deploy-name="gcube-ckan-datacatalog-2.2.0-SNAPSHOT">
@ -29,7 +37,11 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -44,7 +56,11 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -59,20 +75,28 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<dependent-module archiveName="catalogue-util-library-1.0.3.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/catalogue-util-library/catalogue-util-library"> <dependent-module archiveName="catalogue-util-library-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/catalogue-util-library/catalogue-util-library">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
<dependent-module archiveName="ckan-content-moderator-widget-0.2.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan-content-moderator-widget/ckan-content-moderator-widget"> <dependent-module archiveName="ckan-content-moderator-widget-1.0.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan-content-moderator-widget/ckan-content-moderator-widget">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
@ -87,7 +111,11 @@
<property name="context-root" value="gcube-ckan-datacatalog"/> <property name="context-root" value="gcube-ckan-datacatalog"/>
@ -102,7 +130,11 @@
<property name="java-output-path" value="/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/> <property name="java-output-path" value="/gcube-ckan-datacatalog/target/gcube-ckan-datacatalog-1.0.0-SNAPSHOT/WEB-INF/classes"/>
@ -117,7 +149,11 @@
</wb-module> </wb-module>

View File

@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.2.0-SNAPSHOT] - 2022-01-21 ## [v2.2.0-SNAPSHOT] - 2022-01-27
#### Enhancements #### Enhancements

View File

@ -123,7 +123,7 @@
<dependency> <dependency>
<groupId>org.gcube.portlets.widgets</groupId> <groupId>org.gcube.portlets.widgets</groupId>
<artifactId>ckan-content-moderator-widget</artifactId> <artifactId>ckan-content-moderator-widget</artifactId>
<version>[0.0.1, 1.0.0-SNAPSHOT)</version> <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -10,28 +10,25 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.ManageProductRes
import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
/** /**
* The Interface GcubeCkanDataCatalogService. * The Interface GcubeCkanDataCatalogService.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Nov 4, 2016
* Nov 4, 2016
*/ */
@RemoteServiceRelativePath("ckandatacatalogue") @RemoteServiceRelativePath("ckandatacatalogue")
public interface GcubeCkanDataCatalogService extends RemoteService { public interface GcubeCkanDataCatalogService extends RemoteService {
/** /**
* Get the ckan connector access point. * Get the ckan connector access point.
* *
* @param browserLocationURL the browser location URL * @param browserLocationURL the browser location URL
* @param pathInfoParameters the path info parameters * @param pathInfoParameters the path info parameters
* @param queryStringParameters the query string parameters * @param queryStringParameters the query string parameters
* @return the c kan connector * @return the c kan connector
* @throws Exception the exception * @throws Exception the exception
*/ */
CkanConnectorAccessPoint getCKanConnector( CkanConnectorAccessPoint getCKanConnector(String browserLocationURL, String pathInfoParameters,
String browserLocationURL, String pathInfoParameters, String queryStringParameters) throws Exception; String queryStringParameters) throws Exception;
/** /**
* Get the current role in CKAN for this user. * Get the current role in CKAN for this user.
@ -62,32 +59,41 @@ public interface GcubeCkanDataCatalogService extends RemoteService {
*/ */
String logoutFromCkanURL(); String logoutFromCkanURL();
// /** // /**
// * Remove auth cookie for ckan of this user. // * Remove auth cookie for ckan of this user.
// * // *
// * @return the string // * @return the string
// */ // */
// String logoutURIFromCkan(); // String logoutURIFromCkan();
/** /**
* Check if the manage product needs to be shown (e.g., for GRSF products) * Check if the manage product needs to be shown (e.g., for GRSF products)
* @return *
* @return the manage product response
*/ */
ManageProductResponse isManageProductEnabled(); ManageProductResponse isManageProductEnabled();
/** /**
* Check if the view per VRE is enabled, so the management panels but publish/share link must be removed. * Check if the view per VRE is enabled, so the management panels but
* publish/share link must be removed.
*
* @param browserLocationURL the browser location URL * @param browserLocationURL the browser location URL
* @return the string * @return the string
*/ */
String isViewPerVREEnabled(String browserLocationURL); String isViewPerVREEnabled(String browserLocationURL);
/** /**
* Outside login portal. * Outside login portal.
* *
* @return true, if successful * @return true, if successful
*/ */
boolean outsideLoginPortal(); boolean outsideLoginPortal();
/**
* Check moderation enabled.
*
* @param reloadConfig the reload config
* @return the manage product response
*/
ManageProductResponse checkModerationEnabled(boolean reloadConfig);
} }

View File

@ -12,14 +12,10 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.ManageProductRes
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
// TODO: Auto-generated Javadoc
/** /**
* The Interface GcubeCkanDataCatalogServiceAsync. * The Interface GcubeCkanDataCatalogServiceAsync.
* *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Nov 4, 2016
* Nov 4, 2016
*/ */
public interface GcubeCkanDataCatalogServiceAsync { public interface GcubeCkanDataCatalogServiceAsync {
@ -34,14 +30,13 @@ public interface GcubeCkanDataCatalogServiceAsync {
/** /**
* Gets the CKAN connector. * Gets the CKAN connector.
* *
* @param browserLocationURL the browser location URL that performs the call * @param browserLocationURL the browser location URL that performs the call
* @param pathInfoParameters the path info parameters * @param pathInfoParameters the path info parameters
* @param queryStringParameters the query string parameters * @param queryStringParameters the query string parameters
* @param callback the callback * @param callback the callback
* @return the c kan connector * @return the c kan connector
*/ */
void getCKanConnector( void getCKanConnector(String browserLocationURL, String pathInfoParameters, String queryStringParameters,
String browserLocationURL, String pathInfoParameters, String queryStringParameters,
AsyncCallback<CkanConnectorAccessPoint> callback); AsyncCallback<CkanConnectorAccessPoint> callback);
/** /**
@ -57,8 +52,7 @@ public interface GcubeCkanDataCatalogServiceAsync {
* @param callback the callback * @param callback the callback
* @return the ckan organizations names and urls for user * @return the ckan organizations names and urls for user
*/ */
void getCkanOrganizationsNamesAndUrlsForUser( void getCkanOrganizationsNamesAndUrlsForUser(AsyncCallback<List<BeanUserInOrgGroupRole>> callback);
AsyncCallback<List<BeanUserInOrgGroupRole>> callback);
/** /**
* Retrieve the list of groups to whom the user belongs and their urls. * Retrieve the list of groups to whom the user belongs and their urls.
@ -66,10 +60,8 @@ public interface GcubeCkanDataCatalogServiceAsync {
* @param callback the callback * @param callback the callback
* @return the ckan groups names and urls for user * @return the ckan groups names and urls for user
*/ */
void getCkanGroupsNamesAndUrlsForUser( void getCkanGroupsNamesAndUrlsForUser(AsyncCallback<List<BeanUserInOrgGroupRole>> callback);
AsyncCallback<List<BeanUserInOrgGroupRole>> callback);
/** /**
* Checks if is manage product enabled. * Checks if is manage product enabled.
* *
@ -77,20 +69,26 @@ public interface GcubeCkanDataCatalogServiceAsync {
*/ */
void isManageProductEnabled(AsyncCallback<ManageProductResponse> callback); void isManageProductEnabled(AsyncCallback<ManageProductResponse> callback);
/** /**
* Checks if is view per VRE enabled. * Checks if is view per VRE enabled.
* *
* @param browserLocationURL the browser location URL * @param browserLocationURL the browser location URL
* @param callback the callback * @param callback the callback
*/ */
void isViewPerVREEnabled(String browserLocationURL, AsyncCallback<String> callback); void isViewPerVREEnabled(String browserLocationURL, AsyncCallback<String> callback);
/** /**
* Outside login portal. * Outside login portal.
* *
* @param callback the callback * @param callback the callback
*/ */
void outsideLoginPortal(AsyncCallback<Boolean> callback); void outsideLoginPortal(AsyncCallback<Boolean> callback);
/**
* Check moderation enabled.
*
* @param reloadConfig the reload config
* @param callback the callback
*/
void checkModerationEnabled(boolean reloadConfig, AsyncCallback<ManageProductResponse> callback);
} }

View File

@ -15,7 +15,7 @@ public class ClickedCMSManageProductButtonEvent extends GwtEvent<ClickedCMSManag
public static Type<ClickedCMSManageProductButtonEventHandler> TYPE = new Type<ClickedCMSManageProductButtonEventHandler>(); public static Type<ClickedCMSManageProductButtonEventHandler> TYPE = new Type<ClickedCMSManageProductButtonEventHandler>();
/** /**
* Instantiates a new clicked CMS manage product button event. * Instantiates a new clicked Content Moderation System (CMS) manage product button event.
*/ */
public ClickedCMSManageProductButtonEvent() { public ClickedCMSManageProductButtonEvent() {
} }

View File

@ -74,8 +74,8 @@ public class CkanMetadataManagementPanel extends FlowPanel {
private Button uploadToZenodo = new Button("Upload to Zenodo"); private Button uploadToZenodo = new Button("Upload to Zenodo");
private Button insertMeta = new Button("Publish Item"); private Button insertMeta = new Button("Publish Item");
private Button editMeta = new Button("Edit Item"); private Button editMeta = new Button("Edit Item");
private Button manageGRSFProduct = new Button("Manage GRSF Item"); private Button manageGRSFProduct = new Button("Manage GRSF Item"); //GRSF Manage
private Button manageCMS = new Button("Manage Items"); private Button manageCModS = new Button("Manage Items"); //Moderation
private HandlerManager eventBus; private HandlerManager eventBus;
/** /**
@ -108,8 +108,8 @@ public class CkanMetadataManagementPanel extends FlowPanel {
manageGRSFProduct.setType(ButtonType.PRIMARY); manageGRSFProduct.setType(ButtonType.PRIMARY);
manageGRSFProduct.getElement().getStyle().setFloat(Float.RIGHT); manageGRSFProduct.getElement().getStyle().setFloat(Float.RIGHT);
manageCMS.setType(ButtonType.PRIMARY); manageCModS.setType(ButtonType.PRIMARY);
manageCMS.getElement().getStyle().setFloat(Float.RIGHT); manageCModS.getElement().getStyle().setFloat(Float.RIGHT);
// set icons // set icons
home.setIcon(IconType.HOME); home.setIcon(IconType.HOME);
@ -126,7 +126,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
editMeta.setIcon(IconType.EDIT_SIGN); editMeta.setIcon(IconType.EDIT_SIGN);
statistics.setIcon(IconType.BAR_CHART); statistics.setIcon(IconType.BAR_CHART);
manageGRSFProduct.setIcon(IconType.CHECK_SIGN); manageGRSFProduct.setIcon(IconType.CHECK_SIGN);
manageCMS.setIcon(IconType.CHECK_SIGN); manageCModS.setIcon(IconType.CHECK_SIGN);
// hide edit and insert // hide edit and insert
shareLink.setEnabled(false); shareLink.setEnabled(false);
@ -135,16 +135,16 @@ public class CkanMetadataManagementPanel extends FlowPanel {
insertMeta.setVisible(false); insertMeta.setVisible(false);
manageGRSFProduct.setVisible(false); manageGRSFProduct.setVisible(false);
manageGRSFProduct.setEnabled(false); manageGRSFProduct.setEnabled(false);
manageCMS.setVisible(false); manageCModS.setVisible(false);
manageCMS.setEnabled(false); manageCModS.setEnabled(false);
// manage GRSF item info // manage GRSF item info
manageGRSFProduct.setTitle(MANAGE_GRSF_ITEM_TOOLTIP); manageGRSFProduct.setTitle(MANAGE_GRSF_ITEM_TOOLTIP);
manageGRSFProduct.getElement().getStyle().setFontWeight(FontWeight.BOLD); manageGRSFProduct.getElement().getStyle().setFontWeight(FontWeight.BOLD);
// manage CMS item info // manage CMS item info
manageCMS.setTitle(MANAGE_CMS_ITEMS_TOOLTIP); manageCModS.setTitle(MANAGE_CMS_ITEMS_TOOLTIP);
manageCMS.getElement().getStyle().setFontWeight(FontWeight.BOLD); manageCModS.getElement().getStyle().setFontWeight(FontWeight.BOLD);
// add to navigation bar // add to navigation bar
nav.add(home); nav.add(home);
@ -167,7 +167,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
nav.add(insertMeta); nav.add(insertMeta);
nav.add(editMeta); nav.add(editMeta);
nav.add(manageGRSFProduct); nav.add(manageGRSFProduct);
nav.add(manageCMS); nav.add(manageCModS);
nav.setClose(false); nav.setClose(false);
nav.setType(AlertType.INFO); nav.setType(AlertType.INFO);
nav.getElement().getStyle().setMarginBottom(0, Unit.PX); nav.getElement().getStyle().setMarginBottom(0, Unit.PX);
@ -300,7 +300,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
} }
}); });
manageCMS.addClickHandler(new ClickHandler() { manageCModS.addClickHandler(new ClickHandler() {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
@ -373,12 +373,12 @@ public class CkanMetadataManagementPanel extends FlowPanel {
} }
/** /**
* Button to manage the CMS products.. * Button to manage the products under moderation via Content Moderation System (CMS)
* *
* @param value true or false * @param value true or false
*/ */
public void showManageCMSProductsButton(boolean value) { public void showManageCMSProductsButton(boolean value) {
manageCMS.setVisible(value); manageCModS.setVisible(value);
} }
/** /**
@ -387,7 +387,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
* @param value the value * @param value the value
*/ */
public void enableManageCMSProductsButton(boolean value) { public void enableManageCMSProductsButton(boolean value) {
manageCMS.setEnabled(value); manageCModS.setEnabled(value);
} }
/** /**
@ -432,7 +432,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
myOrganizations.setVisible(false); myOrganizations.setVisible(false);
myGroups.setVisible(false); myGroups.setVisible(false);
manageGRSFProduct.setVisible(false); manageGRSFProduct.setVisible(false);
manageCMS.setVisible(false); manageCModS.setVisible(false);
} }
@ -453,7 +453,7 @@ public class CkanMetadataManagementPanel extends FlowPanel {
myGroups.setVisible(false); myGroups.setVisible(false);
statistics.setVisible(false); statistics.setVisible(false);
manageGRSFProduct.setVisible(false); manageGRSFProduct.setVisible(false);
manageCMS.setVisible(false); manageCModS.setVisible(false);
} }

View File

@ -52,10 +52,12 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
private HandlerManager eventBus; private HandlerManager eventBus;
private CkanConnectorAccessPoint ckanAccessPoint; private CkanConnectorAccessPoint ckanAccessPoint;
private ManageProductResponse manageProductResponse = null; private ManageProductResponse manageProductResponse = null;
private ManageProductResponse moderationProductResponse = null;
private String viewPerVREPath = null; private String viewPerVREPath = null;
private static String latestSelectedProductIdentifier; private static String latestSelectedProductIdentifier;
public static final int IFRAME_FIX_HEIGHT = 1800; public static final int IFRAME_FIX_HEIGHT = 1800;
private JSONObject obj; private JSONObject obj;
private boolean reloadCatServiceConfig = true; //only first time the gCat service config is reloaded
/** /**
* Instantiates a new g cube ckan data catalog panel. * Instantiates a new g cube ckan data catalog panel.
@ -227,17 +229,11 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
.isManageProductEnabled(new AsyncCallback<ManageProductResponse>() { .isManageProductEnabled(new AsyncCallback<ManageProductResponse>() {
@Override @Override
public void onSuccess(ManageProductResponse result) { public void onSuccess(ManageProductResponse manageResponse) {
manageProductResponse = result; manageProductResponse = manageResponse;
if (manageProductResponse != null) { if (manageProductResponse != null) {
managementPanel.showManageGRSFProductButton(
if(manageProductResponse.isGRSFManageEnabled()) { manageProductResponse.isManageEnabled());
managementPanel.showManageCMSProductsButton(
manageProductResponse.isManageEnabled());
}else if(manageProductResponse.isManageEnabled()) {
managementPanel.showManageCMSProductsButton(manageProductResponse.isManageEnabled());
managementPanel.enableManageCMSProductsButton(manageProductResponse.isManageEnabled());
}
} }
} }
@ -246,6 +242,26 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
managementPanel.showManageGRSFProductButton(false); managementPanel.showManageGRSFProductButton(false);
} }
}); });
GCubeCkanDataCatalog.service.checkModerationEnabled(reloadCatServiceConfig,
new AsyncCallback<ManageProductResponse>() {
@Override
public void onFailure(Throwable caught) {
managementPanel.showManageCMSProductsButton(
false);
}
@Override
public void onSuccess(ManageProductResponse moderationResponse) {
reloadCatServiceConfig = false;
//here the moderationProductResponse is not null.
moderationProductResponse = moderationResponse;
managementPanel.showManageCMSProductsButton(moderationProductResponse.isManageEnabled());
managementPanel.enableManageCMSProductsButton(moderationProductResponse.isManageEnabled());
}
});
} }
@ -492,7 +508,8 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
managementPanel.enableShareItemButton(productId != null && !productId.isEmpty()); managementPanel.enableShareItemButton(productId != null && !productId.isEmpty());
managementPanel.enablePublishOnZenodoButton(productId != null && !productId.isEmpty()); managementPanel.enablePublishOnZenodoButton(productId != null && !productId.isEmpty());
managementPanel.enableManageGRSFProductButton( managementPanel.enableManageGRSFProductButton(
productId != null && !productId.isEmpty() && manageProductResponse.isGRSFManageEnabled()); productId != null && !productId.isEmpty() && manageProductResponse.isManageEnabled());
//managementPanel.enableManageCMSProductsButton(productId != null && !productId.isEmpty() && moderationProductResponse.isManageEnabled());
} }
} else { } else {
// The data hasn't been sent from your site! // The data hasn't been sent from your site!

View File

@ -517,8 +517,25 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
} }
else{ else{
try{ try{
boolean toReturn = catalogue.isManageProductEnabled(); boolean isManageProductEnabled = catalogue.isManageProductEnabled();
logger.info("isManageProductEnabled: "+toReturn); logger.info("isManageProductEnabled: "+isManageProductEnabled);
//TO BE SURE THAT THE CURRENT CONTEXT IS A GRSF SCOPE FOR ENABLING THE "MANAGE GRSF ITEM"
boolean isGRSFContext = false;
if (scopePerCurrentUrl != null) {
if (scopePerCurrentUrl.toLowerCase().contains("grsf")) {
isGRSFContext = true;
}
}
logger.info("isGRSFContext: "+isGRSFContext);
boolean toReturn = false;
if(isGRSFContext && isManageProductEnabled) {
toReturn = true;
}
logger.info("returning manage enabled: "+toReturn);
ManageProductResponse mpr = new ManageProductResponse(toReturn, scopePerCurrentUrl); ManageProductResponse mpr = new ManageProductResponse(toReturn, scopePerCurrentUrl);
logger.info("Will manage product be enabled for this user? " + mpr); logger.info("Will manage product be enabled for this user? " + mpr);
return mpr; return mpr;
@ -528,6 +545,16 @@ public class GcubeCkanDataCatalogServiceImpl extends RemoteServiceServlet implem
} }
} }
} }
@Override
public ManageProductResponse checkModerationEnabled(boolean reloadConfig) {
logger.info("Checking if the moderation is enabled in the current context, reload config? "+reloadConfig);
String scopePerCurrentUrl = SessionUtil.getScopeFromClientUrl(getThreadLocalRequest());
DataCatalogue catalogue = getCatalogue(scopePerCurrentUrl);
boolean moderationEnabled = catalogue.isModerationEnabled(reloadConfig);
return new ManageProductResponse(moderationEnabled, scopePerCurrentUrl);
}
/** /**
* Ask to liferay. * Ask to liferay.

View File

@ -7,15 +7,16 @@ import java.io.Serializable;
* *
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
* *
* Jun 15, 2021 * Feb 17, 2022
*/ */
public class ManageProductResponse implements Serializable { public class ManageProductResponse implements Serializable {
/** /**
* *
*/ */
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 4042294108868246495L;
private boolean isManageEnabled; // Is GRSF MANAGE in the GRSF context, Is gCat moderation in the other contexts
private boolean isManageEnabled = false;
private String scope; private String scope;
/** /**
@ -72,24 +73,6 @@ public class ManageProductResponse implements Serializable {
this.scope = scope; this.scope = scope;
} }
public boolean isGRSFScope() {
if (this.scope != null) {
if (this.scope.toLowerCase().contains("grsf")) {
return true;
}
}
return false;
}
public boolean isGRSFManageEnabled() {
if (isGRSFScope() && isManageEnabled)
return true;
return false;
}
/** /**
* To string. * To string.
* *

View File

@ -62,13 +62,13 @@
</servlet> </servlet>
<servlet> <servlet>
<servlet-name>greetServlet</servlet-name> <servlet-name>ckanContentModeratorServlet</servlet-name>
<servlet-class>org.gcube.portlets.widgets.ckancontentmoderator.server.CkanContentModeratorServiceImpl</servlet-class> <servlet-class>org.gcube.portlets.widgets.ckancontentmoderator.server.CkanContentModeratorServiceImpl</servlet-class>
</servlet> </servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>greetServlet</servlet-name> <servlet-name>ckanContentModeratorServlet</servlet-name>
<url-pattern>/gCubeCkanDataCatalog/greet</url-pattern> <url-pattern>/gCubeCkanDataCatalog/ckanContentModeratorService</url-pattern>
</servlet-mapping> </servlet-mapping>