task_21363 #1
|
@ -34,13 +34,13 @@ public class CkanContentModeratorCheckConfig {
|
||||||
* @param whenDone the when done
|
* @param whenDone the when done
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
*/
|
*/
|
||||||
public void checkConfigs(final Command whenDone) throws Exception {
|
public void checkConfigs(final Command whenDone, boolean reloadGCatConfig) throws Exception {
|
||||||
|
|
||||||
configurationLoaded = 0;
|
configurationLoaded = 0;
|
||||||
attemptLC = 0;
|
attemptLC = 0;
|
||||||
|
|
||||||
CkanContentModeratorWidgetController.contentModeratorService
|
CkanContentModeratorWidgetController.contentModeratorService
|
||||||
.isContentModeratorEnabled(new AsyncCallback<Boolean>() {
|
.isModerationEnabled(reloadGCatConfig, new AsyncCallback<Boolean>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
|
|
|
@ -21,13 +21,6 @@ import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||||
@RemoteServiceRelativePath("ckanContentModeratorService")
|
@RemoteServiceRelativePath("ckanContentModeratorService")
|
||||||
public interface CkanContentModeratorService extends RemoteService {
|
public interface CkanContentModeratorService extends RemoteService {
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if is content moderator enabled.
|
|
||||||
*
|
|
||||||
* @return true, if is content moderator enabled
|
|
||||||
*/
|
|
||||||
public Boolean isContentModeratorEnabled();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the status. Currently, this only used to change the status from Rejected
|
* Sets the status. Currently, this only used to change the status from Rejected
|
||||||
* to Pending
|
* to Pending
|
||||||
|
@ -74,10 +67,10 @@ public interface CkanContentModeratorService extends RemoteService {
|
||||||
/**
|
/**
|
||||||
* Gets the data for status.
|
* Gets the data for status.
|
||||||
*
|
*
|
||||||
* @param status the status
|
* @param status the status
|
||||||
* @param star@Override tIndex the start index
|
* @param startIndex the start index
|
||||||
* @param lenght the lenght
|
* @param lenght the lenght
|
||||||
* @param serverIndex the server index
|
* @param serverIndex the server index
|
||||||
* @return the data for status
|
* @return the data for status
|
||||||
* @throws Exception the exception
|
* @throws Exception the exception
|
||||||
* @par@Override am lenght the lenght
|
* @par@Override am lenght the lenght
|
||||||
|
@ -102,11 +95,19 @@ public interface CkanContentModeratorService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
ModerationUserRole getCMSRolesForUserInTheContext() throws Exception;
|
ModerationUserRole getCMSRolesForUserInTheContext() throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is moderation enabled.
|
||||||
|
*
|
||||||
|
* @param reloadConfig the reload config
|
||||||
|
* @return the boolean
|
||||||
|
*/
|
||||||
|
Boolean isModerationEnabled(boolean reloadConfig);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is moderator role assigned.
|
* Checks if is moderator role assigned.
|
||||||
*
|
*
|
||||||
* @return the moderation user role
|
* @return true, if is moderator role assigned
|
||||||
* @throws Exception the exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
Boolean isModeratorRoleAssigned() throws Exception;
|
Boolean isModeratorRoleAssigned() throws Exception;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,13 +19,6 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
*/
|
*/
|
||||||
public interface CkanContentModeratorServiceAsync {
|
public interface CkanContentModeratorServiceAsync {
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if is content moderator enabled.
|
|
||||||
*
|
|
||||||
* @param callback the callback
|
|
||||||
*/
|
|
||||||
void isContentModeratorEnabled(AsyncCallback<Boolean> callback);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reject item.
|
* Reject item.
|
||||||
*
|
*
|
||||||
|
@ -96,6 +89,14 @@ public interface CkanContentModeratorServiceAsync {
|
||||||
*/
|
*/
|
||||||
void getCMSRolesForUserInTheContext(AsyncCallback<ModerationUserRole> callback);
|
void getCMSRolesForUserInTheContext(AsyncCallback<ModerationUserRole> callback);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is moderation enabled.
|
||||||
|
*
|
||||||
|
* @param reloadConfig the reload config
|
||||||
|
* @param callback the callback
|
||||||
|
*/
|
||||||
|
void isModerationEnabled(boolean reloadConfig, AsyncCallback<Boolean> callback);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is moderator role assigned.
|
* Checks if is moderator role assigned.
|
||||||
*
|
*
|
||||||
|
|
|
@ -29,31 +29,27 @@ import com.google.gwt.user.server.rpc.RemoteServiceServlet;
|
||||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
*
|
*
|
||||||
* Jan 11, 2022
|
* Jan 11, 2022
|
||||||
|
* @return the boolean
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implements CkanContentModeratorService {
|
public class CkanContentModeratorServiceImpl extends RemoteServiceServlet implements CkanContentModeratorService {
|
||||||
|
|
||||||
private static Logger LOG = LoggerFactory.getLogger(CkanContentModeratorServiceImpl.class);
|
private static Logger LOG = LoggerFactory.getLogger(CkanContentModeratorServiceImpl.class);
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if is content moderator enabled.
|
|
||||||
*
|
|
||||||
* @return true, if is content moderator enabled
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean isContentModeratorEnabled() {
|
public Boolean isModerationEnabled(boolean reloadConfig) {
|
||||||
LOG.info("called isContentModeratorEnabled");
|
LOG.info("called isContentModeratorEnabled");
|
||||||
String scope = setContexts();
|
String scope = setContexts();
|
||||||
boolean isContentModeratorEnabled = false;
|
boolean isModerationEnabled = false;
|
||||||
try {
|
try {
|
||||||
DataCatalogueImpl catalogueImpl = CatalogueCMSFactory.getFactory().getCatalogueImplPerScope(scope);
|
DataCatalogueImpl catalogueImpl = CatalogueCMSFactory.getFactory().getCatalogueImplPerScope(scope);
|
||||||
CatalogueContentModeratorSystem cmsInstance = catalogueImpl.getCatalogueContentModerator();
|
CatalogueContentModeratorSystem cmsInstance = catalogueImpl.getCatalogueContentModerator();
|
||||||
isContentModeratorEnabled = cmsInstance.isContentModeratorEnabled();
|
isModerationEnabled = cmsInstance.isModerationEnabled(reloadConfig);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error("Error occured on cheching isContentModeratorEnabled, so returning false", e);
|
LOG.error("Error occured on checking isContentModeratorEnabled, so returning false", e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return isContentModeratorEnabled;
|
return isModerationEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue