Search in sources :

Example 16 with Configuration

use of org.hisp.dhis.configuration.Configuration in project dhis2-core by dhis2.

the class ConfigurationController method setSystemId.

@PreAuthorize("hasRole('ALL')")
@ResponseStatus(value = HttpStatus.OK)
@RequestMapping(value = "/systemId", method = RequestMethod.POST)
public void setSystemId(@RequestBody(required = false) String systemId) {
    systemId = ObjectUtils.firstNonNull(systemId, UUID.randomUUID().toString());
    Configuration config = configurationService.getConfiguration();
    config.setSystemId(systemId);
    configurationService.setConfiguration(config);
}
Also used : Configuration(org.hisp.dhis.configuration.Configuration) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 17 with Configuration

use of org.hisp.dhis.configuration.Configuration in project dhis2-core by dhis2.

the class ConfigurationController method removeFeedbackRecipients.

@PreAuthorize("hasRole('ALL') or hasRole('F_SYSTEM_SETTING')")
@RequestMapping(value = "/feedbackRecipients", method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.NO_CONTENT)
public void removeFeedbackRecipients() {
    Configuration config = configurationService.getConfiguration();
    config.setFeedbackRecipients(null);
    configurationService.setConfiguration(config);
}
Also used : Configuration(org.hisp.dhis.configuration.Configuration) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Configuration (org.hisp.dhis.configuration.Configuration)17 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)13 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)13 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)12 NotFoundException (org.hisp.dhis.webapi.controller.exception.NotFoundException)7 UserGroup (org.hisp.dhis.user.UserGroup)2 Date (java.util.Date)1 DhisSpringTest (org.hisp.dhis.DhisSpringTest)1 DataElementGroup (org.hisp.dhis.dataelement.DataElementGroup)1 IndicatorGroup (org.hisp.dhis.indicator.IndicatorGroup)1 OrganisationUnit (org.hisp.dhis.organisationunit.OrganisationUnit)1 OrganisationUnitLevel (org.hisp.dhis.organisationunit.OrganisationUnitLevel)1 PeriodType (org.hisp.dhis.period.PeriodType)1 User (org.hisp.dhis.user.User)1 UserAuthorityGroup (org.hisp.dhis.user.UserAuthorityGroup)1 Test (org.junit.Test)1 HttpStatus (org.springframework.http.HttpStatus)1 HttpClientErrorException (org.springframework.web.client.HttpClientErrorException)1 HttpServerErrorException (org.springframework.web.client.HttpServerErrorException)1 ResourceAccessException (org.springframework.web.client.ResourceAccessException)1