← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20479: System setting controller, added POST for smtp and remote server passwords.

 

------------------------------------------------------------
revno: 20479
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-10-02 17:18:05 +0200
message:
  System setting controller, added POST for smtp and remote server passwords.
modified:
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/ConfigurationController.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== 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 );