Result acceptDomainRequest(@RequestParam Long requestId, @RequestParam(value = "domainIds[]") List<Long> domainIds) {
Result result = new Result();
result.setResult(false);
boolean success = false;
DomainRequest domainRequest = domainRequestService.get(requestId);
for (Long domainId : domainIds) {
Domain assignedDomain = domainService.get(domainId);
InviteeForm inviteeForm = new InviteeForm();
inviteeForm.setEmail(domainRequest.getEmailAddress());
inviteeForm.setName(domainRequest.getFirstName() + " " + domainRequest.getLastName());
UserRole userRole = DomainType.GROUP.equals(assignedDomain.getDomainType()) ? UserRole.ROLE_GROUP_USER : UserRole.ROLE_ORG_USER;
inviteeForm.setUserRole(userRole);
success = invitationControllerService.inviteUserToDomain(domainRequest.getEmailAddress(), domainId, userRole, false);
}
domainRequestService.delete(requestId);
result.setResult(success);