~stian-sandvold/dhis2/AnalyticsByUser

« back to all changes in this revision

Viewing changes to dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/user/UserController.java

  • Committer: Stian Sandvold
  • Date: 2016-08-03 09:05:19 UTC
  • mfrom: (23568.1.32 dhis2)
  • Revision ID: stian.sandvold@gmail.com-20160803090519-sw34m18dzycv2amz
merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
import org.hisp.dhis.webapi.webdomain.WebMetadata;
68
68
import org.hisp.dhis.webapi.webdomain.WebOptions;
69
69
import org.springframework.beans.factory.annotation.Autowired;
 
70
import org.springframework.http.HttpStatus;
70
71
import org.springframework.security.access.prepost.PreAuthorize;
71
72
import org.springframework.stereotype.Controller;
72
73
import org.springframework.web.bind.annotation.PathVariable;
73
74
import org.springframework.web.bind.annotation.RequestMapping;
74
75
import org.springframework.web.bind.annotation.RequestMethod;
 
76
import org.springframework.web.bind.annotation.ResponseStatus;
75
77
 
76
78
import javax.servlet.http.HttpServletRequest;
77
79
import javax.servlet.http.HttpServletResponse;
235
237
    }
236
238
 
237
239
    @RequestMapping( value = BULK_INVITE_PATH, method = RequestMethod.POST, consumes = { "application/xml", "text/xml" } )
 
240
    @ResponseStatus( HttpStatus.NO_CONTENT )
238
241
    public void postXmlInvites( HttpServletRequest request, HttpServletResponse response ) throws Exception
239
242
    {
240
243
        Users users = renderService.fromXml( request.getInputStream(), Users.class );
254
257
    }
255
258
 
256
259
    @RequestMapping( value = "/{id}" + INVITE_PATH, method = RequestMethod.POST )
 
260
    @ResponseStatus( HttpStatus.NO_CONTENT )
257
261
    public void resendInvite( @PathVariable String id, HttpServletRequest request, HttpServletResponse response ) throws Exception
258
262
    {
259
263
        User user = userService.getUser( id );
283
287
    }
284
288
 
285
289
    @RequestMapping( value = BULK_INVITE_PATH, method = RequestMethod.POST, consumes = "application/json" )
 
290
    @ResponseStatus( HttpStatus.NO_CONTENT )
286
291
    public void postJsonInvites( HttpServletRequest request, HttpServletResponse response ) throws Exception
287
292
    {
288
293
        Users users = renderService.fromJson( request.getInputStream(), Users.class );
349
354
        userReplica.setUid( CodeGenerator.generateCode() );
350
355
        userReplica.setCode( null );
351
356
        userReplica.setCreated( new Date() );
352
 
        
 
357
 
353
358
        UserCredentials credentialsReplica = new UserCredentials();
354
359
        credentialsReplica.mergeWith( existingUser.getUserCredentials(), MergeMode.MERGE );
355
360
        credentialsReplica.setUid( CodeGenerator.generateCode() );