test_class.declarator: USER_ID_1 = randomUUID()
test_class.modifier: private static final
test_class.original_string: private static final UUID USER_ID_1 = randomUUID();
test_class.type: UUID
test_class.var_name: USER_ID_1
test_class.declarator: USER_ID_2 = randomUUID()
test_class.modifier: private static final
test_class.original_string: private static final UUID USER_ID_2 = randomUUID();
test_class.type: UUID
test_class.var_name: USER_ID_2
test_class.declarator: ORGANIZATION_ID_1 = randomUUID()
test_class.modifier: private static final
test_class.original_string: private static final UUID ORGANIZATION_ID_1 = randomUUID();
test_class.type: UUID
test_class.var_name: ORGANIZATION_ID_1
test_class.declarator: ORGANIZATION_ID_2 = randomUUID()
test_class.modifier: private static final
test_class.original_string: private static final UUID ORGANIZATION_ID_2 = randomUUID();
test_class.type: UUID
test_class.var_name: ORGANIZATION_ID_2
test_class.declarator: ORG_1_USER_1 = new User(USER_ID_1, ORGANIZATION_ID_1, "org-1-user-1", "org-1-user-1-display")
test_class.modifier: private static final
test_class.original_string: private static final User ORG_1_USER_1 = new User(USER_ID_1, ORGANIZATION_ID_1, "org-1-user-1", "org-1-user-1-display");
test_class.type: User
test_class.var_name: ORG_1_USER_1
test_class.declarator: ORG_2_USER_1 = new User(USER_ID_2, ORGANIZATION_ID_2, "org-2-user-1", "org-2-user-1-display")
test_class.modifier: private static final
test_class.original_string: private static final User ORG_2_USER_1 = new User(USER_ID_2, ORGANIZATION_ID_2, "org-2-user-1", "org-2-user-1-display");
test_class.type: User
test_class.var_name: ORG_2_USER_1
test_class.declarator: USER_USERNAME = "user@umbrella.com"
test_class.modifier: private static final
test_class.original_string: private static final String USER_USERNAME = "user@umbrella.com";
test_class.type: String
test_class.var_name: USER_USERNAME
test_class.declarator: ADMIN_USERNAME = "admin@umbrella.com"
test_class.modifier: private static final
test_class.original_string: private static final String ADMIN_USERNAME = "admin@umbrella.com";
test_class.type: String
test_class.var_name: ADMIN_USERNAME
test_class.declarator: ROLE_ADMIN = "ADMIN"
test_class.modifier: private static final
test_class.original_string: private static final String ROLE_ADMIN = "ADMIN";
test_class.type: String
test_class.var_name: ROLE_ADMIN
test_class.declarator: ROLE_ORGANIZATION_ADMIN = "ORG_ADMIN"
test_class.modifier: private static final
test_class.original_string: private static final String ROLE_ORGANIZATION_ADMIN = "ORG_ADMIN";
test_class.type: String
test_class.var_name: ROLE_ORGANIZATION_ADMIN
test_class.declarator: ROLE_ORGANIZATION_USER = "ORG_USER"
test_class.modifier: private static final
test_class.original_string: private static final String ROLE_ORGANIZATION_USER = "ORG_USER";
test_class.type: String
test_class.var_name: ROLE_ORGANIZATION_USER
test_class.declarator: mockMvc
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private MockMvc mockMvc;
test_class.type: MockMvc
test_class.var_name: mockMvc
test_class.declarator: objectMapper
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private ObjectMapper objectMapper;
test_class.type: ObjectMapper
test_class.var_name: objectMapper
test_class.declarator: readServiceProvider
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private ReadServiceProvider readServiceProvider;
test_class.type: ReadServiceProvider
test_class.var_name: readServiceProvider
test_class.declarator: usersService
test_class.modifier: @MockBean
      private
test_class.original_string: @MockBean
      private UsersService usersService;
test_class.type: UsersService
test_class.var_name: usersService
test_class.declarator: usersReadService
test_class.modifier: @MockBean
      private
test_class.original_string: @MockBean
      private UsersReadService usersReadService;
test_class.type: UsersReadService
test_class.var_name: usersReadService
test_class.file: api/src/test/java/engineering/everest/lhotse/api/rest/controllers/UsersControllerTest.java
test_class.identifier: UsersControllerTest
test_case.body: @Test
      @WithMockUser(username = USER_USERNAME, roles = ROLE_ORGANIZATION_USER)
      void updateUserDetailsWillDelegate_WhenRequestingUserIsTargetUser() throws Exception {
          var authUser = MockAuthenticationContextProvider.getAuthUser();
          when(usersReadService.getById(authUser.getId())).thenReturn(authUser);
          mockMvc.perform(put("/api/users/{userId}", authUser.getId())
                  .contentType(APPLICATION_JSON)
                  .content(objectMapper.writeValueAsString(new UpdateUserRequest("display-name-change", "email-change", "password-change"))))
                  .andExpect(status().isOk());
  
          verify(usersService).updateUser(authUser.getId(), authUser.getId(), "email-change",
                  "display-name-change", "password-change");
      }
test_case.class_method_signature: UsersControllerTest.updateUserDetailsWillDelegate_WhenRequestingUserIsTargetUser()
test_case.full_signature: @Test @WithMockUser(username = USER_USERNAME, roles = ROLE_ORGANIZATION_USER) void updateUserDetailsWillDelegate_WhenRequestingUserIsTargetUser()
test_case.identifier: updateUserDetailsWillDelegate_WhenRequestingUserIsTargetUser
test_case.invocations: getAuthUser thenReturn when getById getId andExpect perform content contentType put getId writeValueAsString isOk status updateUser verify getId getId
test_case.modifiers: @Test @WithMockUser(username = USER_USERNAME, roles = ROLE_ORGANIZATION_USER)
test_case.parameters: ()
test_case.return: void
test_case.signature: void updateUserDetailsWillDelegate_WhenRequestingUserIsTargetUser()
focal_class.declarator: dtoConverter
focal_class.modifier: private final
focal_class.original_string: private final DtoConverter dtoConverter;
focal_class.type: DtoConverter
focal_class.var_name: dtoConverter
focal_class.declarator: usersService
focal_class.modifier: private final
focal_class.original_string: private final UsersService usersService;
focal_class.type: UsersService
focal_class.var_name: usersService
focal_class.declarator: usersReadService
focal_class.modifier: private final
focal_class.original_string: private final UsersReadService usersReadService;
focal_class.type: UsersReadService
focal_class.var_name: usersReadService
focal_class.file: api/src/main/java/engineering/everest/lhotse/api/rest/controllers/UsersController.java
focal_class.identifier: UsersController
focal_class.class_method_signature: UsersController.UsersController(DtoConverter dtoConverter,
                             UsersService usersService,
                             UsersReadService usersReadService)
focal_class.full_signature: @Autowired public  UsersController(DtoConverter dtoConverter,
                             UsersService usersService,
                             UsersReadService usersReadService)
focal_class.identifier: UsersController
focal_class.modifiers: @Autowired public
focal_class.parameters: (DtoConverter dtoConverter,
                             UsersService usersService,
                             UsersReadService usersReadService)
focal_class.signature:  UsersController(DtoConverter dtoConverter,
                             UsersService usersService,
                             UsersReadService usersReadService)
focal_class.class_method_signature: UsersController.getAllUsers()
focal_class.full_signature: @GetMapping @ApiOperation(produces = APPLICATION_JSON_VALUE, value = "Retrieves entire user list for all organisations") @AdminOnly public List<UserResponse> getAllUsers()
focal_class.identifier: getAllUsers
focal_class.modifiers: @GetMapping @ApiOperation(produces = APPLICATION_JSON_VALUE, value = "Retrieves entire user list for all organisations") @AdminOnly public
focal_class.parameters: ()
focal_class.return: List<UserResponse>
focal_class.signature: List<UserResponse> getAllUsers()
focal_class.class_method_signature: UsersController.getUser(User requestingUser, @PathVariable UUID userId)
focal_class.full_signature: @GetMapping("/{userId}") @ApiOperation(produces = APPLICATION_JSON_VALUE, value = "Retrieves user details") @PostAuthorize("hasRole('ADMIN') or returnObject.organizationId == #requestingUser.organizationId") public UserResponse getUser(User requestingUser, @PathVariable UUID userId)
focal_class.identifier: getUser
focal_class.modifiers: @GetMapping("/{userId}") @ApiOperation(produces = APPLICATION_JSON_VALUE, value = "Retrieves user details") @PostAuthorize("hasRole('ADMIN') or returnObject.organizationId == #requestingUser.organizationId") public
focal_class.parameters: (User requestingUser, @PathVariable UUID userId)
focal_class.return: UserResponse
focal_class.signature: UserResponse getUser(User requestingUser, @PathVariable UUID userId)
focal_class.class_method_signature: UsersController.updateUser(User requestingUser, @PathVariable UUID userId, @RequestBody @Valid UpdateUserRequest request)
focal_class.full_signature: @PutMapping("/{userId}") @ApiOperation("Update an organization user's details") @PreAuthorize("#requestingUser.id == #userId or hasPermission(#userId, 'User', 'update')") public void updateUser(User requestingUser, @PathVariable UUID userId, @RequestBody @Valid UpdateUserRequest request)
focal_class.identifier: updateUser
focal_class.modifiers: @PutMapping("/{userId}") @ApiOperation("Update an organization user's details") @PreAuthorize("#requestingUser.id == #userId or hasPermission(#userId, 'User', 'update')") public
focal_class.parameters: (User requestingUser, @PathVariable UUID userId, @RequestBody @Valid UpdateUserRequest request)
focal_class.return: void
focal_class.signature: void updateUser(User requestingUser, @PathVariable UUID userId, @RequestBody @Valid UpdateUserRequest request)
focal_method.body: @PutMapping("/{userId}")
      @ApiOperation("Update an organization user's details")
      @PreAuthorize("#requestingUser.id == #userId or hasPermission(#userId, 'User', 'update')")
      public void updateUser(User requestingUser, @PathVariable UUID userId, @RequestBody @Valid UpdateUserRequest request) {
          usersService.updateUser(requestingUser.getId(), userId,
                  request.getEmail(), request.getDisplayName(), request.getPassword());
      }
focal_method.class_method_signature: UsersController.updateUser(User requestingUser, @PathVariable UUID userId, @RequestBody @Valid UpdateUserRequest request)
focal_method.full_signature: @PutMapping("/{userId}") @ApiOperation("Update an organization user's details") @PreAuthorize("#requestingUser.id == #userId or hasPermission(#userId, 'User', 'update')") public void updateUser(User requestingUser, @PathVariable UUID userId, @RequestBody @Valid UpdateUserRequest request)
focal_method.identifier: updateUser
focal_method.invocations: updateUser getId getEmail getDisplayName getPassword
focal_method.modifiers: @PutMapping("/{userId}") @ApiOperation("Update an organization user's details") @PreAuthorize("#requestingUser.id == #userId or hasPermission(#userId, 'User', 'update')") public
focal_method.parameters: (User requestingUser, @PathVariable UUID userId, @RequestBody @Valid UpdateUserRequest request)
focal_method.return: void
focal_method.signature: void updateUser(User requestingUser, @PathVariable UUID userId, @RequestBody @Valid UpdateUserRequest request)