Package com.unosquare.carmigo.controller
Class PlatformUserController
java.lang.Object
com.unosquare.carmigo.controller.PlatformUserController
Handles Platform User APIs.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<?>confirmEmail(String email) Enables user to confirm their email after creating an account.org.springframework.http.ResponseEntity<PlatformUserResponse>createPlatformUser(@Valid PlatformUserRequest platformUserRequest) Enables a user to create an account.org.springframework.http.ResponseEntity<?>Enables logged-in user's to delete their profile.org.springframework.http.ResponseEntity<?>deletePlatformUserById(int platformUserId) Enables logged-in admin users to delete a user's profile.org.springframework.http.ResponseEntity<PlatformUserResponse>getCurrentPlatformUserProfile(boolean refreshCache) Enables logged-in users to see their profiles.org.springframework.http.ResponseEntity<PlatformUserResponse>getPlatformUserById(int platformUserId, boolean refreshCache) Enables logged-in admin users to see other user's profiles.org.springframework.http.ResponseEntity<PlatformUserResponse>patchCurrentPlatformUser(com.github.fge.jsonpatch.JsonPatch patch) Enables logged-in users to correct their profiles.org.springframework.http.ResponseEntity<PlatformUserResponse>patchPlatformUserById(int platformUserId, com.github.fge.jsonpatch.JsonPatch patch) Enables admin logged-in users to correct other user's profiles.
-
Constructor Details
-
PlatformUserController
public PlatformUserController()
-
-
Method Details
-
createPlatformUser
@PostMapping(value="/create", produces="application/json") public org.springframework.http.ResponseEntity<PlatformUserResponse> createPlatformUser(@Valid @RequestBody @Valid PlatformUserRequest platformUserRequest) Enables a user to create an account. This new user's access status is set to STAGED.- Parameters:
platformUserRequest- Request body asPlatformUserRequest.- Returns:
- Response body as
PlatformUserResponse.
-
confirmEmail
@PostMapping("/confirm-email") public org.springframework.http.ResponseEntity<?> confirmEmail(@RequestParam String email) Enables user to confirm their email after creating an account. Upon confirmation, their access status is set to ACTIVE.- Parameters:
email- the email used to create an account.- Returns:
- an empty body.
-
getCurrentPlatformUserProfile
@GetMapping(value="/profile", produces="application/json") @PreAuthorize("hasAuthority(\'ACTIVE\') or hasAuthority(\'SUSPENDED\') or hasAuthority(\'ADMIN\') or hasAuthority(\'DEV\')") public org.springframework.http.ResponseEntity<PlatformUserResponse> getCurrentPlatformUserProfile(@RequestParam(value="refreshCache",required=false) boolean refreshCache) Enables logged-in users to see their profiles.- Returns:
- Response body as
PlatformUserResponse.
-
getPlatformUserById
@GetMapping(value="/{platformUserId}", produces="application/json") @PreAuthorize("hasAuthority(\'ADMIN\')") public org.springframework.http.ResponseEntity<PlatformUserResponse> getPlatformUserById(@PathVariable int platformUserId, @RequestParam(value="refreshCache",required=false) boolean refreshCache) Enables logged-in admin users to see other user's profiles.- Parameters:
platformUserId- the platform user's id.- Returns:
- Response body as
PlatformUserResponse.
-
patchCurrentPlatformUser
@PatchMapping(consumes="application/json-patch+json") @PreAuthorize("hasAuthority(\'ACTIVE\') or hasAuthority(\'SUSPENDED\') or hasAuthority(\'ADMIN\') or hasAuthority(\'DEV\')") public org.springframework.http.ResponseEntity<PlatformUserResponse> patchCurrentPlatformUser(@RequestBody com.github.fge.jsonpatch.JsonPatch patch) Enables logged-in users to correct their profiles.- Parameters:
patch- Request body asJsonPatch.- Returns:
- Response body as
PlatformUserResponse.
-
patchPlatformUserById
@PatchMapping(value="/{platformUserId}", consumes="application/json-patch+json") @PreAuthorize("hasAuthority(\'ADMIN\')") public org.springframework.http.ResponseEntity<PlatformUserResponse> patchPlatformUserById(@PathVariable int platformUserId, @RequestBody com.github.fge.jsonpatch.JsonPatch patch) Enables admin logged-in users to correct other user's profiles.- Parameters:
platformUserId- the platform user's id.patch- Request body asJsonPatch.- Returns:
- Response body as
PlatformUserResponse.
-
deleteCurrentPlatformUser
@DeleteMapping @PreAuthorize("hasAuthority(\'ACTIVE\') or hasAuthority(\'ADMIN\')") public org.springframework.http.ResponseEntity<?> deleteCurrentPlatformUser()Enables logged-in user's to delete their profile.- Returns:
- an empty body.
-
deletePlatformUserById
@DeleteMapping("/{platformUserId}") @PreAuthorize("hasAuthority(\'ADMIN\')") public org.springframework.http.ResponseEntity<?> deletePlatformUserById(@PathVariable int platformUserId) Enables logged-in admin users to delete a user's profile.- Parameters:
platformUserId- the platform user's id.- Returns:
- an empty body.
-