=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ConfigurationController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ConfigurationController.java 2015-09-14 17:57:00 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ConfigurationController.java 2015-10-02 15:18:05 +0000 @@ -69,6 +69,10 @@ @Autowired private PeriodService periodService; + // ------------------------------------------------------------------------- + // Resources + // ------------------------------------------------------------------------- + @PreAuthorize( "hasRole('ALL') or hasRole('F_SYSTEM_SETTING')" ) @ResponseStatus( value = HttpStatus.OK ) @RequestMapping( value = "/systemId", method = RequestMethod.GET ) @@ -264,6 +268,58 @@ configurationService.setConfiguration( config ); } + @PreAuthorize( "hasRole('ALL') or hasRole('F_SYSTEM_SETTING')" ) + @ResponseStatus( value = HttpStatus.OK ) + @RequestMapping( value = "/smtpPassword/{password}", method = RequestMethod.POST ) + public void setSmtpPassword( @PathVariable String password ) + { + Configuration config = configurationService.getConfiguration(); + + config.setSmtpPassword( password ); + + configurationService.setConfiguration( config ); + } + + @PreAuthorize( "hasRole('ALL') or hasRole('F_SYSTEM_SETTING')" ) + @ResponseStatus( value = HttpStatus.OK ) + @RequestMapping( value = "/remoteServerUrl/{url}", method = RequestMethod.POST ) + public void setRemoteServerUrl( @PathVariable String url ) + { + Configuration config = configurationService.getConfiguration(); + + config.setRemoteServerUrl( url ); + + configurationService.setConfiguration( config ); + } + + @PreAuthorize( "hasRole('ALL') or hasRole('F_SYSTEM_SETTING')" ) + @ResponseStatus( value = HttpStatus.OK ) + @RequestMapping( value = "/remoteServerUsername/{username}", method = RequestMethod.POST ) + public void setRemoteServerUsername( @PathVariable String username ) + { + Configuration config = configurationService.getConfiguration(); + + config.setRemoteServerUsername( username ); + + configurationService.setConfiguration( config ); + } + + @PreAuthorize( "hasRole('ALL') or hasRole('F_SYSTEM_SETTING')" ) + @ResponseStatus( value = HttpStatus.OK ) + @RequestMapping( value = "/remoteServerPassword/{password}", method = RequestMethod.POST ) + public void setRemoteServerPassword( @PathVariable String password ) + { + Configuration config = configurationService.getConfiguration(); + + config.setRemoteServerPassword( password ); + + configurationService.setConfiguration( config ); + } + + // ------------------------------------------------------------------------- + // Supportive methods + // ------------------------------------------------------------------------- + private String setModel( Model model, Object entity ) { model.addAttribute( "model", entity );