mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 01:54:22 +00:00
[CST-4981] statistics usage restricted to admin via configuration
This commit is contained in:
@@ -57,6 +57,7 @@ import org.dspace.eperson.EPerson;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.dspace.statistics.factory.StatisticsServiceFactory;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
@@ -102,6 +103,7 @@ public class StatisticsRestRepositoryIT extends AbstractControllerIntegrationTes
|
||||
|
||||
// Explicitly use solr commit in SolrLoggerServiceImpl#postView
|
||||
configurationService.setProperty("solr-statistics.autoCommit", false);
|
||||
configurationService.setProperty("usage-statistics.authorization.admin.usage", true);
|
||||
|
||||
context.turnOffAuthorisationSystem();
|
||||
|
||||
@@ -124,6 +126,12 @@ public class StatisticsRestRepositoryIT extends AbstractControllerIntegrationTes
|
||||
context.restoreAuthSystemState();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
|
||||
configurationService.setProperty("usage-statistics.authorization.admin.usage", false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void usagereports_withoutId_NotImplementedException() throws Exception {
|
||||
getClient().perform(get("/api/statistics/usagereports"))
|
||||
|
@@ -44,6 +44,7 @@ import org.dspace.content.Item;
|
||||
import org.dspace.content.Site;
|
||||
import org.dspace.content.service.SiteService;
|
||||
import org.dspace.services.ConfigurationService;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -127,6 +128,13 @@ public class ViewUsageStatisticsFeatureIT extends AbstractControllerIntegrationT
|
||||
collectionARest = collectionConverter.convert(collectionA, Projection.DEFAULT);
|
||||
itemARest = itemConverter.convert(itemA, Projection.DEFAULT);
|
||||
bitstreamARest = bitstreamConverter.convert(bitstreamA, Projection.DEFAULT);
|
||||
configurationService.setProperty("usage-statistics.authorization.admin.usage", true);
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
|
||||
configurationService.setProperty("usage-statistics.authorization.admin.usage", false);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Reference in New Issue
Block a user