test_class.declarator: ORGANIZATION_ID = randomUUID()
test_class.modifier: private static final
test_class.original_string: private static final UUID ORGANIZATION_ID = randomUUID();
test_class.type: UUID
test_class.var_name: ORGANIZATION_ID
test_class.declarator: USER_ID = randomUUID()
test_class.modifier: private static final
test_class.original_string: private static final UUID USER_ID = randomUUID();
test_class.type: UUID
test_class.var_name: USER_ID
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: RAW_PASSWORD = "secret"
test_class.modifier: private static final
test_class.original_string: private static final String RAW_PASSWORD = "secret";
test_class.type: String
test_class.var_name: RAW_PASSWORD
test_class.declarator: NEW_USER_USERNAME = "new@umbrella.com"
test_class.modifier: private static final
test_class.original_string: private static final String NEW_USER_USERNAME = "new@umbrella.com";
test_class.type: String
test_class.var_name: NEW_USER_USERNAME
test_class.declarator: NEW_USER_DISPLAY_NAME = "new user"
test_class.modifier: private static final
test_class.original_string: private static final String NEW_USER_DISPLAY_NAME = "new user";
test_class.type: String
test_class.var_name: NEW_USER_DISPLAY_NAME
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_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: NEW_USER_REQUEST = new NewUserRequest(NEW_USER_USERNAME, RAW_PASSWORD, NEW_USER_DISPLAY_NAME)
test_class.modifier: private static final
test_class.original_string: private static final NewUserRequest NEW_USER_REQUEST = new NewUserRequest(NEW_USER_USERNAME, RAW_PASSWORD, NEW_USER_DISPLAY_NAME);
test_class.type: NewUserRequest
test_class.var_name: NEW_USER_REQUEST
test_class.declarator: ORGANIZATION_1 = new Organization(fromString("53ac29ab-ecc6-431e-bde0-64440cd3dc93"),
              "organization-1", new OrganizationAddress("street-1", "city-1",
              "state-1", "country-1", "postal-1"), "website-1", "contactName", "phoneNumber", "email@company.com", false)
test_class.modifier: private static final
test_class.original_string: private static final Organization ORGANIZATION_1 = new Organization(fromString("53ac29ab-ecc6-431e-bde0-64440cd3dc93"),
              "organization-1", new OrganizationAddress("street-1", "city-1",
              "state-1", "country-1", "postal-1"), "website-1", "contactName", "phoneNumber", "email@company.com", false);
test_class.type: Organization
test_class.var_name: ORGANIZATION_1
test_class.declarator: ORGANIZATION_2 = new Organization(fromString("a29797ff-11eb-40e4-9024-30e8cca17096"),
              "organization-2", new OrganizationAddress("street-2", "city-2",
              "state-2", "country-2", "postal-2"), "website-2", "", "", "", false)
test_class.modifier: private static final
test_class.original_string: private static final Organization ORGANIZATION_2 = new Organization(fromString("a29797ff-11eb-40e4-9024-30e8cca17096"),
              "organization-2", new OrganizationAddress("street-2", "city-2",
              "state-2", "country-2", "postal-2"), "website-2", "", "", "", false);
test_class.type: Organization
test_class.var_name: ORGANIZATION_2
test_class.declarator: ORG_1_USER_1 = new User(randomUUID(), ORGANIZATION_1.getId(), "user11@email.com", "new-user-display-name-11", false)
test_class.modifier: private static final
test_class.original_string: private static final User ORG_1_USER_1 = new User(randomUUID(), ORGANIZATION_1.getId(), "user11@email.com", "new-user-display-name-11", false);
test_class.type: User
test_class.var_name: ORG_1_USER_1
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: organizationsService
test_class.modifier: @MockBean
      private
test_class.original_string: @MockBean
      private OrganizationsService organizationsService;
test_class.type: OrganizationsService
test_class.var_name: organizationsService
test_class.declarator: pendingRegistrationsService
test_class.modifier: @MockBean
      private
test_class.original_string: @MockBean
      private PendingRegistrationsService pendingRegistrationsService;
test_class.type: PendingRegistrationsService
test_class.var_name: pendingRegistrationsService
test_class.declarator: organizationsReadService
test_class.modifier: @MockBean
      private
test_class.original_string: @MockBean
      private OrganizationsReadService organizationsReadService;
test_class.type: OrganizationsReadService
test_class.var_name: organizationsReadService
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.declarator: randomFieldsGenerator
test_class.modifier: @MockBean
      private
test_class.original_string: @MockBean
      private RandomFieldsGenerator randomFieldsGenerator;
test_class.type: RandomFieldsGenerator
test_class.var_name: randomFieldsGenerator
test_class.file: api/src/test/java/engineering/everest/lhotse/api/rest/controllers/OrganizationsControllerTest.java
test_class.identifier: OrganizationsControllerTest
test_case.body: @Test
      @WithMockUser(username = ADMIN_USERNAME, roles = ROLE_ADMIN)
      void creatingOrganizationUserWillDelegate_WhenRequestingUserIsAdmin() throws Exception {
          User authUser = MockAuthenticationContextProvider.getAuthUser();
          mockMvc.perform(post("/api/organizations/{organizationId}/users", ORGANIZATION_ID)
                  .contentType(APPLICATION_JSON)
                  .content(objectMapper.writeValueAsString(NEW_USER_REQUEST)))
                  .andExpect(status().isCreated())
                  .andExpect(content().string(Matchers.any(String.class)));
  
          verify(usersService).createUser(authUser.getId(), ORGANIZATION_ID, NEW_USER_USERNAME, NEW_USER_DISPLAY_NAME, RAW_PASSWORD);
      }
test_case.class_method_signature: OrganizationsControllerTest.creatingOrganizationUserWillDelegate_WhenRequestingUserIsAdmin()
test_case.full_signature: @Test @WithMockUser(username = ADMIN_USERNAME, roles = ROLE_ADMIN) void creatingOrganizationUserWillDelegate_WhenRequestingUserIsAdmin()
test_case.identifier: creatingOrganizationUserWillDelegate_WhenRequestingUserIsAdmin
test_case.invocations: getAuthUser andExpect andExpect perform content contentType post writeValueAsString isCreated status string content any createUser verify getId
test_case.modifiers: @Test @WithMockUser(username = ADMIN_USERNAME, roles = ROLE_ADMIN)
test_case.parameters: ()
test_case.return: void
test_case.signature: void creatingOrganizationUserWillDelegate_WhenRequestingUserIsAdmin()
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: organizationsService
focal_class.modifier: private final
focal_class.original_string: private final OrganizationsService organizationsService;
focal_class.type: OrganizationsService
focal_class.var_name: organizationsService
focal_class.declarator: organizationsReadService
focal_class.modifier: private final
focal_class.original_string: private final OrganizationsReadService organizationsReadService;
focal_class.type: OrganizationsReadService
focal_class.var_name: organizationsReadService
focal_class.declarator: pendingRegistrationsService
focal_class.modifier: private final
focal_class.original_string: private final PendingRegistrationsService pendingRegistrationsService;
focal_class.type: PendingRegistrationsService
focal_class.var_name: pendingRegistrationsService
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.declarator: randomFieldsGenerator
focal_class.modifier: private final
focal_class.original_string: private final RandomFieldsGenerator randomFieldsGenerator;
focal_class.type: RandomFieldsGenerator
focal_class.var_name: randomFieldsGenerator
focal_class.file: api/src/main/java/engineering/everest/lhotse/api/rest/controllers/OrganizationsController.java
focal_class.identifier: OrganizationsController
focal_class.class_method_signature: OrganizationsController.OrganizationsController(DtoConverter dtoConverter,
                                     OrganizationsService organizationsService,
                                     OrganizationsReadService organizationsReadService,
                                     PendingRegistrationsService pendingRegistrationsService,
                                     UsersService usersService,
                                     UsersReadService usersReadService,
                                     RandomFieldsGenerator randomFieldsGenerator)
focal_class.full_signature: @Autowired public  OrganizationsController(DtoConverter dtoConverter,
                                     OrganizationsService organizationsService,
                                     OrganizationsReadService organizationsReadService,
                                     PendingRegistrationsService pendingRegistrationsService,
                                     UsersService usersService,
                                     UsersReadService usersReadService,
                                     RandomFieldsGenerator randomFieldsGenerator)
focal_class.identifier: OrganizationsController
focal_class.modifiers: @Autowired public
focal_class.parameters: (DtoConverter dtoConverter,
                                     OrganizationsService organizationsService,
                                     OrganizationsReadService organizationsReadService,
                                     PendingRegistrationsService pendingRegistrationsService,
                                     UsersService usersService,
                                     UsersReadService usersReadService,
                                     RandomFieldsGenerator randomFieldsGenerator)
focal_class.signature:  OrganizationsController(DtoConverter dtoConverter,
                                     OrganizationsService organizationsService,
                                     OrganizationsReadService organizationsReadService,
                                     PendingRegistrationsService pendingRegistrationsService,
                                     UsersService usersService,
                                     UsersReadService usersReadService,
                                     RandomFieldsGenerator randomFieldsGenerator)
focal_class.class_method_signature: OrganizationsController.getOrganization(User requestingUser, @PathVariable UUID organizationId)
focal_class.full_signature: @GetMapping("/{organizationId}") @ResponseStatus(OK) @ApiOperation("Get information for an organization") @AdminOrUserOfTargetOrganization public OrganizationResponse getOrganization(User requestingUser, @PathVariable UUID organizationId)
focal_class.identifier: getOrganization
focal_class.modifiers: @GetMapping("/{organizationId}") @ResponseStatus(OK) @ApiOperation("Get information for an organization") @AdminOrUserOfTargetOrganization public
focal_class.parameters: (User requestingUser, @PathVariable UUID organizationId)
focal_class.return: OrganizationResponse
focal_class.signature: OrganizationResponse getOrganization(User requestingUser, @PathVariable UUID organizationId)
focal_class.class_method_signature: OrganizationsController.registerOrganization(@RequestBody @Valid RegisterOrganizationRequest request)
focal_class.full_signature: @PostMapping("/register") @ResponseStatus(CREATED) @ApiOperation("Register a new organization") public OrganizationRegistrationResponse registerOrganization(@RequestBody @Valid RegisterOrganizationRequest request)
focal_class.identifier: registerOrganization
focal_class.modifiers: @PostMapping("/register") @ResponseStatus(CREATED) @ApiOperation("Register a new organization") public
focal_class.parameters: (@RequestBody @Valid RegisterOrganizationRequest request)
focal_class.return: OrganizationRegistrationResponse
focal_class.signature: OrganizationRegistrationResponse registerOrganization(@RequestBody @Valid RegisterOrganizationRequest request)
focal_class.class_method_signature: OrganizationsController.confirmOrganizationContactEmail(@PathVariable UUID organizationId, @PathVariable UUID confirmationCode)
focal_class.full_signature: @GetMapping("/{organizationId}/register/{confirmationCode}") // Can't easily POST from an email link @ResponseStatus(OK) @ApiOperation("Confirm the email address used to register an organization") public void confirmOrganizationContactEmail(@PathVariable UUID organizationId, @PathVariable UUID confirmationCode)
focal_class.identifier: confirmOrganizationContactEmail
focal_class.modifiers: @GetMapping("/{organizationId}/register/{confirmationCode}") // Can't easily POST from an email link @ResponseStatus(OK) @ApiOperation("Confirm the email address used to register an organization") public
focal_class.parameters: (@PathVariable UUID organizationId, @PathVariable UUID confirmationCode)
focal_class.return: void
focal_class.signature: void confirmOrganizationContactEmail(@PathVariable UUID organizationId, @PathVariable UUID confirmationCode)
focal_class.class_method_signature: OrganizationsController.updateOrganization(User requestingUser,
                                     @PathVariable UUID organizationId,
                                     @RequestBody @Valid UpdateOrganizationRequest request)
focal_class.full_signature: @PutMapping("/{organizationId}") @ResponseStatus(OK) @ApiOperation("Update Organization") @AdminOrAdminOfTargetOrganization public void updateOrganization(User requestingUser,
                                     @PathVariable UUID organizationId,
                                     @RequestBody @Valid UpdateOrganizationRequest request)
focal_class.identifier: updateOrganization
focal_class.modifiers: @PutMapping("/{organizationId}") @ResponseStatus(OK) @ApiOperation("Update Organization") @AdminOrAdminOfTargetOrganization public
focal_class.parameters: (User requestingUser,
                                     @PathVariable UUID organizationId,
                                     @RequestBody @Valid UpdateOrganizationRequest request)
focal_class.return: void
focal_class.signature: void updateOrganization(User requestingUser,
                                     @PathVariable UUID organizationId,
                                     @RequestBody @Valid UpdateOrganizationRequest request)
focal_class.class_method_signature: OrganizationsController.listOrganizationUsers(User requestingUser, @PathVariable UUID organizationId)
focal_class.full_signature: @GetMapping("/{organizationId}/users") @ApiOperation(produces = APPLICATION_JSON_VALUE, value = "Retrieve a list of users for an organization") @AdminOrUserOfTargetOrganization public List<UserResponse> listOrganizationUsers(User requestingUser, @PathVariable UUID organizationId)
focal_class.identifier: listOrganizationUsers
focal_class.modifiers: @GetMapping("/{organizationId}/users") @ApiOperation(produces = APPLICATION_JSON_VALUE, value = "Retrieve a list of users for an organization") @AdminOrUserOfTargetOrganization public
focal_class.parameters: (User requestingUser, @PathVariable UUID organizationId)
focal_class.return: List<UserResponse>
focal_class.signature: List<UserResponse> listOrganizationUsers(User requestingUser, @PathVariable UUID organizationId)
focal_class.class_method_signature: OrganizationsController.createUser(User requestingUser, @PathVariable UUID organizationId, @RequestBody @Valid NewUserRequest request)
focal_class.full_signature: @PostMapping("/{organizationId}/users") @ApiOperation(produces = APPLICATION_JSON_VALUE, value = "Create a new user for an organization") @ResponseStatus(CREATED) @AdminOrAdminOfTargetOrganization public UUID createUser(User requestingUser, @PathVariable UUID organizationId, @RequestBody @Valid NewUserRequest request)
focal_class.identifier: createUser
focal_class.modifiers: @PostMapping("/{organizationId}/users") @ApiOperation(produces = APPLICATION_JSON_VALUE, value = "Create a new user for an organization") @ResponseStatus(CREATED) @AdminOrAdminOfTargetOrganization public
focal_class.parameters: (User requestingUser, @PathVariable UUID organizationId, @RequestBody @Valid NewUserRequest request)
focal_class.return: UUID
focal_class.signature: UUID createUser(User requestingUser, @PathVariable UUID organizationId, @RequestBody @Valid NewUserRequest request)
focal_method.body: @PostMapping("/{organizationId}/users")
      @ApiOperation(produces = APPLICATION_JSON_VALUE, value = "Create a new user for an organization")
      @ResponseStatus(CREATED)
      @AdminOrAdminOfTargetOrganization
      public UUID createUser(User requestingUser, @PathVariable UUID organizationId, @RequestBody @Valid NewUserRequest request) {
          return usersService.createUser(requestingUser.getId(),
                  organizationId, request.getUsername(), request.getDisplayName(), request.getPassword());
      }
focal_method.class_method_signature: OrganizationsController.createUser(User requestingUser, @PathVariable UUID organizationId, @RequestBody @Valid NewUserRequest request)
focal_method.full_signature: @PostMapping("/{organizationId}/users") @ApiOperation(produces = APPLICATION_JSON_VALUE, value = "Create a new user for an organization") @ResponseStatus(CREATED) @AdminOrAdminOfTargetOrganization public UUID createUser(User requestingUser, @PathVariable UUID organizationId, @RequestBody @Valid NewUserRequest request)
focal_method.identifier: createUser
focal_method.invocations: createUser getId getUsername getDisplayName getPassword
focal_method.modifiers: @PostMapping("/{organizationId}/users") @ApiOperation(produces = APPLICATION_JSON_VALUE, value = "Create a new user for an organization") @ResponseStatus(CREATED) @AdminOrAdminOfTargetOrganization public
focal_method.parameters: (User requestingUser, @PathVariable UUID organizationId, @RequestBody @Valid NewUserRequest request)
focal_method.return: UUID
focal_method.signature: UUID createUser(User requestingUser, @PathVariable UUID organizationId, @RequestBody @Valid NewUserRequest request)