Merged in CST-11012-demo (pull request #1019)

CST-11012 demo
This commit is contained in:
Mattia Vianelli
2023-09-18 11:07:12 +00:00
4 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
package org.dspace.app.rest.authorization.impl;
import org.dspace.app.rest.authorization.AuthorizationFeature;
import org.dspace.app.rest.authorization.AuthorizationFeatureDocumentation;
import org.dspace.app.rest.model.BaseObjectRest;
import org.dspace.app.rest.model.SiteRest;
import org.dspace.core.Context;
import org.dspace.discovery.SearchServiceException;
import org.dspace.services.ConfigurationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.sql.SQLException;
@Component
@AuthorizationFeatureDocumentation(name = CoarNotifyLdnEnabled.NAME,
description = "It can be used to verify if the user can see the coar notify protocol is enabled")
public class CoarNotifyLdnEnabled implements AuthorizationFeature {
public final static String NAME = "coarLdnEnabled";
@Autowired
private ConfigurationService configurationService;
@Override
public boolean isAuthorized(Context context, BaseObjectRest object) throws SQLException, SearchServiceException {
return configurationService.getBooleanProperty("coar-notify.enabled", true);
}
@Override
public String[] getSupportedTypes() {
return new String[]{SiteRest.CATEGORY+"."+SiteRest.NAME};
}
}

View File

@@ -1694,3 +1694,4 @@ include = ${module_dir}/usage-statistics.cfg
include = ${module_dir}/versioning.cfg
include = ${module_dir}/workflow.cfg
include = ${module_dir}/external-providers.cfg
include = ${module_dir}/coar-notify-ldn.cfg

View File

@@ -0,0 +1,9 @@
#---------------------------------------------------------------#
#---------------COAR NOTIFY LDN CONFIGURATION-------------------#
#---------------------------------------------------------------#
# Configuration properties used by Coar Notify and ldn #
#---------------------------------------------------------------#
#Boolean to determine if Coar Notify is enabled globally for entire site.
#default => true
coar-notify.enabled = true

View File

@@ -52,6 +52,7 @@ rest.properties.exposed = google.recaptcha.mode
rest.properties.exposed = cc.license.jurisdiction
rest.properties.exposed = identifiers.item-status.register-doi
rest.properties.exposed = authentication-password.domain.valid
rest.properties.exposed = coar-notify.enabled
#---------------------------------------------------------------#
# These configs are used by the deprecated REST (v4-6) module #