Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
haiphucnguyen committed Jan 6, 2025
1 parent 4c5671e commit 6b6e0eb
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.flowinquiry.modules.usermanagement.web.rest.errors;
package io.flowinquiry.modules.usermanagement;

import io.flowinquiry.exceptions.UserException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.flowinquiry.modules.usermanagement.web.rest.errors;
package io.flowinquiry.modules.usermanagement;

import io.flowinquiry.exceptions.UserException;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.flowinquiry.modules.usermanagement.web.rest.errors;
package io.flowinquiry.modules.usermanagement;

import io.flowinquiry.exceptions.UserException;

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import io.flowinquiry.exceptions.ResourceNotFoundException;
import io.flowinquiry.modules.usermanagement.AuthoritiesConstants;
import io.flowinquiry.modules.usermanagement.EmailAlreadyUsedException;
import io.flowinquiry.modules.usermanagement.InvalidPasswordException;
import io.flowinquiry.modules.usermanagement.domain.Authority;
import io.flowinquiry.modules.usermanagement.domain.Permission;
import io.flowinquiry.modules.usermanagement.domain.User;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import static io.flowinquiry.security.SecurityUtils.USER_ID;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.flowinquiry.modules.usermanagement.InvalidLoginException;
import io.flowinquiry.modules.usermanagement.repository.UserRepository;
import io.flowinquiry.modules.usermanagement.service.UserService;
import io.flowinquiry.modules.usermanagement.service.dto.FwUserDetails;
import io.flowinquiry.modules.usermanagement.service.dto.UserDTO;
import io.flowinquiry.modules.usermanagement.web.rest.errors.InvalidLoginException;
import jakarta.validation.Valid;
import java.time.Instant;
import java.time.LocalDateTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import io.flowinquiry.modules.fss.service.StorageService;
import io.flowinquiry.modules.usermanagement.AuthoritiesConstants;
import io.flowinquiry.modules.usermanagement.EmailAlreadyUsedException;
import io.flowinquiry.modules.usermanagement.domain.User;
import io.flowinquiry.modules.usermanagement.repository.UserRepository;
import io.flowinquiry.modules.usermanagement.service.UserService;
import io.flowinquiry.modules.usermanagement.service.dto.ResourcePermissionDTO;
import io.flowinquiry.modules.usermanagement.service.dto.UserDTO;
import io.flowinquiry.modules.usermanagement.service.dto.UserHierarchyDTO;
import io.flowinquiry.modules.usermanagement.web.rest.errors.EmailAlreadyUsedException;
import io.flowinquiry.query.Filter;
import io.flowinquiry.query.QueryDTO;
import io.flowinquiry.utils.Obfuscator;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package io.flowinquiry.modules.usermanagement.web.rest;

import io.flowinquiry.modules.collab.service.MailService;
import io.flowinquiry.modules.usermanagement.EmailAlreadyUsedException;
import io.flowinquiry.modules.usermanagement.InvalidPasswordException;
import io.flowinquiry.modules.usermanagement.domain.User;
import io.flowinquiry.modules.usermanagement.repository.UserRepository;
import io.flowinquiry.modules.usermanagement.service.UserService;
import io.flowinquiry.modules.usermanagement.service.dto.PasswordChangeDTO;
import io.flowinquiry.modules.usermanagement.service.dto.UserDTO;
import io.flowinquiry.modules.usermanagement.service.dto.UserKey;
import io.flowinquiry.modules.usermanagement.service.mapper.UserMapper;
import io.flowinquiry.modules.usermanagement.web.rest.errors.EmailAlreadyUsedException;
import io.flowinquiry.modules.usermanagement.web.rest.errors.InvalidPasswordException;
import io.flowinquiry.security.SecurityUtils;
import jakarta.validation.Valid;
import jakarta.validation.constraints.Email;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
import io.flowinquiry.exceptions.ResourceConstraintException;
import io.flowinquiry.exceptions.ResourceNotFoundException;
import io.flowinquiry.exceptions.UserException;
import io.flowinquiry.modules.usermanagement.EmailAlreadyUsedException;
import io.flowinquiry.modules.usermanagement.InvalidLoginException;
import io.flowinquiry.modules.usermanagement.InvalidPasswordException;
import java.util.HashMap;
import java.util.Map;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.core.AuthenticationException;
import org.springframework.web.server.ResponseStatusException;

Expand All @@ -19,8 +23,10 @@ public class ExceptionStatusMapper {
// Populate the map with exception-to-status mappings
exceptionToStatusMap.put(IllegalArgumentException.class, HttpStatus.BAD_REQUEST);
exceptionToStatusMap.put(InvalidLoginException.class, HttpStatus.BAD_REQUEST);
exceptionToStatusMap.put(InvalidPasswordException.class, HttpStatus.BAD_REQUEST);
exceptionToStatusMap.put(EmailAlreadyUsedException.class, HttpStatus.BAD_REQUEST);
exceptionToStatusMap.put(UserException.class, HttpStatus.BAD_REQUEST);
exceptionToStatusMap.put(BadCredentialsException.class, HttpStatus.UNAUTHORIZED);
exceptionToStatusMap.put(AccessDeniedException.class, HttpStatus.FORBIDDEN);
exceptionToStatusMap.put(AuthenticationException.class, HttpStatus.UNAUTHORIZED);
exceptionToStatusMap.put(ResponseStatusException.class, HttpStatus.NOT_FOUND);
Expand Down

0 comments on commit 6b6e0eb

Please sign in to comment.