Package de.dlr.proseo.usermgr.rest
Class UserControllerImpl
java.lang.Object
de.dlr.proseo.usermgr.rest.UserControllerImpl
- All Implemented Interfaces:
UserController
Spring MVC controller for the prosEO User Manager; implements the services
required to manage user accounts.
- Author:
- Dr. Thomas Bassler
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<String> countUsers(String missionCode) Count the users matching the specified mission.org.springframework.http.ResponseEntity<RestUser> createUser(@Valid RestUser restUser) Create a new userorg.springframework.http.ResponseEntity<?> deleteUserByName(String username) Delete a user by user nameorg.springframework.http.ResponseEntity<RestUser> getUserByName(String username) Get a user by nameGet users by mission (may be null, if root user sends request)org.springframework.http.ResponseEntity<RestUser> modifyUser(String username, RestUser restUser) Update a user by name
-
Constructor Details
-
UserControllerImpl
public UserControllerImpl()
-
-
Method Details
-
getUsers
public org.springframework.http.ResponseEntity<List<RestUser>> getUsers(String mission, Integer recordFrom, Integer recordTo) Get users by mission (may be null, if root user sends request)- Specified by:
getUsersin interfaceUserController- Parameters:
mission- the mission coderecordFrom- first record of filtered and ordered result to returnrecordTo- last record of filtered and ordered result to return- Returns:
- HTTP status "OK" and a list of Json objects representing users authorized for the given mission or HTTP status "NOT_FOUND" and an error message, if no users matching the search criteria were found HTTP status "TOO MANY REQUESTS" if the result list exceeds a configured maximum
-
createUser
public org.springframework.http.ResponseEntity<RestUser> createUser(@Valid @Valid RestUser restUser) Create a new user- Specified by:
createUserin interfaceUserController- Parameters:
restUser- a Json representation of the new user- Returns:
- HTTP status "CREATED" and a response containing a Json object corresponding to the user after persistence (with ACL security identity ID) or HTTP status "BAD_REQUEST", if any of the input data was invalid
-
getUserByName
Get a user by name- Specified by:
getUserByNamein interfaceUserController- Parameters:
username- the user name- Returns:
- HTTP status "OK" and a Json object corresponding to the user found or HTTP status "BAD_REQUEST" and an error message, if no user name was given, or HTTP status "UNAUTHORIZED" and an error message, if a user (not user mgr) attempted to access the data of another user, or HTTP status "NOT_FOUND" and an error message, if no user with the given name exists
-
deleteUserByName
Delete a user by user name- Specified by:
deleteUserByNamein interfaceUserController- Parameters:
username- the name of the user to delete- Returns:
- a response entity with HTTP status "NO_CONTENT", if the deletion was successful, or HTTP status "NOT_FOUND", if the user did not exist, or HTTP status "NOT_MODIFIED", if the deletion was unsuccessful
-
modifyUser
public org.springframework.http.ResponseEntity<RestUser> modifyUser(String username, RestUser restUser) Update a user by name- Specified by:
modifyUserin interfaceUserController- Parameters:
username- the name of the user to updaterestUser- a Json object containing the modified (and unmodified) attributes- Returns:
- HTTP status "OK" and a response containing a Json object corresponding to the user after modification or HTTP status "NOT_MODIFIED" and a warning message, if the input date was the same as the database data, or HTTP status "NOT_FOUND" and an error message, if no user with the given name exists, or HTTP status "BAD_REQUEST" and an error message, if any of the input data was invalid, or HTTP status "UNAUTHORIZED" and an error message, if a user (not user mgr) attempted to change anything but their own password, or HTTP status "CONFLICT"and an error message, if the user has been modified since retrieval by the client
-
countUsers
Count the users matching the specified mission.- Specified by:
countUsersin interfaceUserController- Parameters:
missionCode- the mission- Returns:
- the number of matching users as a String (may be zero) or HTTP status "BAD_REQUEST" if the request was not made by the root user or no mission was provided
-