Search in sources :

Example 1 with Users

use of org.hisp.dhis.user.Users in project dhis2-core by dhis2.

the class UserController method postXmlInvites.

@RequestMapping(value = BULK_INVITE_PATH, method = RequestMethod.POST, consumes = { "application/xml", "text/xml" })
@ResponseStatus(HttpStatus.NO_CONTENT)
public void postXmlInvites(HttpServletRequest request, HttpServletResponse response) throws Exception {
    Users users = renderService.fromXml(request.getInputStream(), Users.class);
    User currentUser = currentUserService.getCurrentUser();
    for (User user : users.getUsers()) {
        if (!validateInviteUser(user, currentUser)) {
            return;
        }
    }
    for (User user : users.getUsers()) {
        inviteUser(user, currentUser, request);
    }
}
Also used : User(org.hisp.dhis.user.User) Users(org.hisp.dhis.user.Users) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with Users

use of org.hisp.dhis.user.Users in project dhis2-core by dhis2.

the class UserController method postJsonInvites.

@RequestMapping(value = BULK_INVITE_PATH, method = RequestMethod.POST, consumes = "application/json")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void postJsonInvites(HttpServletRequest request, HttpServletResponse response) throws Exception {
    Users users = renderService.fromJson(request.getInputStream(), Users.class);
    User currentUser = currentUserService.getCurrentUser();
    for (User user : users.getUsers()) {
        if (!validateInviteUser(user, currentUser)) {
            return;
        }
    }
    for (User user : users.getUsers()) {
        inviteUser(user, currentUser, request);
    }
}
Also used : User(org.hisp.dhis.user.User) Users(org.hisp.dhis.user.Users) ResponseStatus(org.springframework.web.bind.annotation.ResponseStatus) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

User (org.hisp.dhis.user.User)2 Users (org.hisp.dhis.user.Users)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseStatus (org.springframework.web.bind.annotation.ResponseStatus)2