Class UserController


  • @RestController
    @RequestMapping("/api/v1/users")
    public class UserController
    extends java.lang.Object
    • Constructor Detail

      • UserController

        public UserController()
    • Method Detail

      • getUser

        @GetMapping("/{user_id}")
        @PreAuthorize("hasAnyRole(\'ROLE_USER\',\'ROLE_ADMIN\')")
        public org.springframework.http.ResponseEntity<UserDTO> getUser​(@PathVariable("user_id")
                                                                        long userId)
      • editUser

        @PostMapping("/{user_id}")
        @PreAuthorize("#userId == principal.userId or hasRole(\'ROLE_ADMIN\')")
        public org.springframework.http.ResponseEntity<UserDTO> editUser​(@PathVariable("user_id")
                                                                         long userId,
                                                                         @RequestBody
                                                                         UserEditDTO userEditDTO)
      • deleteUser

        @DeleteMapping("/{user_id}")
        @PreAuthorize("#userId == principal.userId or hasRole(\'ROLE_ADMIN\')")
        public org.springframework.http.ResponseEntity<java.lang.String> deleteUser​(@PathVariable("user_id")
                                                                                    long userId)
      • getUserActivities

        @GetMapping("/{user_id}/activities")
        @PreAuthorize("#userId == principal.userId or hasRole(\'ROLE_ADMIN\')")
        public org.springframework.http.ResponseEntity<java.util.Set<Activity>> getUserActivities​(@PathVariable("user_id")
                                                                                                  long userId)
      • removeUserFromActivity

        @DeleteMapping("/{user_id}/activities/{activity_id}")
        @PreAuthorize("#userId == principal.userId or hasRole(\'ROLE_ADMIN\')")
        public org.springframework.http.ResponseEntity<java.lang.String> removeUserFromActivity​(@PathVariable("user_id")
                                                                                                long userId,
                                                                                                @PathVariable("activity_id")
                                                                                                long activityId)
      • getFutureActivities

        @GetMapping("/{user_id}/my-activities")
        @PreAuthorize("#userId == principal.userId or hasRole(\'ROLE_ADMIN\')")
        public org.springframework.http.ResponseEntity<java.util.List<Activity>> getFutureActivities​(@PathVariable("user_id")
                                                                                                     java.lang.Long userId)
      • getOrganizedActivities

        @GetMapping("/{user_id}/organized-activities")
        @PreAuthorize("#userId == principal.userId or hasRole(\'ROLE_ADMIN\')")
        public org.springframework.http.ResponseEntity<java.util.List<Activity>> getOrganizedActivities​(@PathVariable("user_id")
                                                                                                        java.lang.Long userId)