From 4f9887e364aa2589f6453440d82235611f00b006 Mon Sep 17 00:00:00 2001 From: ani2689 Date: Fri, 31 May 2024 09:26:48 +0900 Subject: [PATCH 1/2] =?UTF-8?q?fix=20::=20=EC=A1=B8=EC=97=85=EC=83=9D=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=97=90=EB=9F=AC=20=ED=95=B4?= =?UTF-8?q?=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt | 2 +- .../team/msg/sms/domain/user/service/impl/GetUserServiceImpl.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt index f60a5e9a..e7497f12 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt @@ -29,7 +29,7 @@ class WithdrawalUseCase( ) { fun execute() { val user = userService.getCurrentUser() - if (user.roles[0].name == "ROLE_STUDENT") { + if (user.roles[0].name == "ROLE_STUDENT" || user.roles[0].name == "ROLE_GRADUATE") { val student = studentService.getStudentByUser(user) val project = projectService.getAllProjectByStudentId(student.id) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/user/service/impl/GetUserServiceImpl.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/user/service/impl/GetUserServiceImpl.kt index 48da29f1..bdd73b21 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/user/service/impl/GetUserServiceImpl.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/user/service/impl/GetUserServiceImpl.kt @@ -18,7 +18,7 @@ class GetUserServiceImpl( ) : GetUserService { override fun getRoleByGAuthInfo(email: String, role: String): Role { val user = queryUserPort.queryUserByEmail(email) ?: return when (role) { - "ROLE_STUDENT" -> Role.ROLE_STUDENT + "ROLE_STUDENT", "ROLE_GRADUATE" -> Role.ROLE_STUDENT "ROLE_TEACHER" -> Role.ROLE_TEACHER else -> throw RoleNotExistsException } From d76b50c21eda6b990011bb02ac173dccffebfa60 Mon Sep 17 00:00:00 2001 From: ani2689 Date: Fri, 31 May 2024 09:58:03 +0900 Subject: [PATCH 2/2] refactor :: role enum --- .../team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt b/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt index e7497f12..8e516430 100644 --- a/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt +++ b/sms-core/src/main/kotlin/team/msg/sms/domain/auth/usecase/WithdrawalUseCase.kt @@ -1,6 +1,7 @@ package team.msg.sms.domain.auth.usecase import team.msg.sms.common.annotation.UseCase +import team.msg.sms.domain.auth.model.Role import team.msg.sms.domain.certificate.service.CertificateService import team.msg.sms.domain.file.service.ImageService import team.msg.sms.domain.languagecertificate.service.LanguageCertificateService @@ -29,7 +30,7 @@ class WithdrawalUseCase( ) { fun execute() { val user = userService.getCurrentUser() - if (user.roles[0].name == "ROLE_STUDENT" || user.roles[0].name == "ROLE_GRADUATE") { + if (user.roles[0] == Role.ROLE_STUDENT) { val student = studentService.getStudentByUser(user) val project = projectService.getAllProjectByStudentId(student.id)