Skip to content

Commit

Permalink
Merge pull request #284 from GSM-MSG/283-feat/service-owner-transfer-…
Browse files Browse the repository at this point in the history
…during-student-verification-logic-added

🔀 :: 서비스 소유자 위임 중 재학생 검증 로직
  • Loading branch information
Umjiseung authored Mar 8, 2024
2 parents 285383f + e7d4bff commit 2d16170
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.msg.gauth.domain.client.exception

import com.msg.gauth.global.exception.ErrorCode
import com.msg.gauth.global.exception.exceptions.BasicException

class InvalidDelegateUserException: BasicException(ErrorCode.INVALID_DELEGATE_USER)
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package com.msg.gauth.domain.client.service
import com.msg.gauth.domain.client.Client
import com.msg.gauth.domain.client.exception.BadDelegateUserIdRequestException
import com.msg.gauth.domain.client.exception.ClientNotFindException
import com.msg.gauth.domain.client.exception.InvalidDelegateUserException
import com.msg.gauth.domain.client.exception.UserNotMatchException
import com.msg.gauth.domain.client.repository.ClientRepository
import com.msg.gauth.domain.user.enums.UserRoleType
import com.msg.gauth.domain.user.exception.UserNotFoundException
import com.msg.gauth.domain.user.repository.UserRepository
import com.msg.gauth.domain.user.util.UserUtil
Expand Down Expand Up @@ -33,6 +35,9 @@ class DelegateOwnerService(
val delegateUser = userRepository.findByIdOrNull(delegateUserId)
?: throw UserNotFoundException()

if (delegateUser.userRole.any { it.userRoleType != UserRoleType.ROLE_STUDENT })
throw InvalidDelegateUserException()

val updateClient = Client(
id = client.id,
clientId = client.clientId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ enum class ErrorCode(
CLIENT_SECRET_MISMATCH("클라이언트 시크릿이 일치하지 않습니다.", 400),
FILE_EXTENSION_INVALID("파일 확장자가 유효하지 않습니다.", 400),
ALREADY_AUTHENTICATED_MAIL("이미 인증된 메일 입니다.", 400),
INVALID_DELEGATE_USER("유효하지 않은 위임자입니다.", 400),

AUTH_CODE_EXPIRED("메일 인증이 만료되었습니다.", 401),
UNAUTHORIZED("권한 없음", 401),
Expand Down

0 comments on commit 2d16170

Please sign in to comment.