-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
42 changed files
with
177 additions
and
151 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
hyunsub-auth/src/main/kotlin/kim/hyunsub/auth/bo/admin/AdminUserBo.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package kim.hyunsub.auth.bo.admin | ||
|
||
import kim.hyunsub.auth.model.api.ApiUser | ||
import kim.hyunsub.auth.model.dto.admin.AdminUserCreateParams | ||
import kim.hyunsub.auth.model.dto.auth.UserCreateParams | ||
import kim.hyunsub.auth.model.dto.auth.UserCreateResult | ||
import kim.hyunsub.auth.repository.UserAuthorityRepository | ||
import kim.hyunsub.auth.repository.UserRepository | ||
import kim.hyunsub.auth.service.UserService | ||
import kim.hyunsub.common.web.model.SimpleResponse | ||
import org.springframework.stereotype.Service | ||
|
||
@Service | ||
class AdminUserBo( | ||
private val userService: UserService, | ||
private val userRepository: UserRepository, | ||
private val userAuthorityRepository: UserAuthorityRepository, | ||
) { | ||
fun list(): List<ApiUser> { | ||
val users = userRepository.findAll() | ||
val userAuthorities = userAuthorityRepository.findAll() | ||
|
||
val authorityMap = userAuthorities.groupBy { it.userIdNo } | ||
|
||
return users | ||
.map { UserCreateResult(it, authorityMap[it.idNo] ?: emptyList()) } | ||
.map { it.toApi() } | ||
} | ||
|
||
fun get(idNo: String): ApiUser { | ||
return userService.get(idNo).toApi() | ||
} | ||
|
||
fun create(params: AdminUserCreateParams): ApiUser { | ||
val userCreateParams = UserCreateParams( | ||
username = params.name, | ||
password = "password", | ||
) | ||
|
||
return userService.create(userCreateParams).toApi() | ||
} | ||
|
||
fun delete(idNo: String): SimpleResponse { | ||
userService.delete(idNo) | ||
return SimpleResponse() | ||
} | ||
|
||
private fun UserCreateResult.toApi() = ApiUser( | ||
idNo = user.idNo, | ||
username = user.username, | ||
authorities = authorities.map { it.authorityId }, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
hyunsub-auth/src/main/kotlin/kim/hyunsub/auth/controller/admin/AdminAuthorityController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
hyunsub-auth/src/main/kotlin/kim/hyunsub/auth/controller/admin/TokenController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...unsub/auth/controller/LogoutController.kt → .../auth/controller/auth/LogoutController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ub/auth/controller/NginxAuthController.kt → ...th/controller/auth/NginxAuthController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
hyunsub-auth/src/main/kotlin/kim/hyunsub/auth/controller/auth/RsaKeyController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
hyunsub-auth/src/main/kotlin/kim/hyunsub/auth/controller/auth/ValidUrlController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...sub/auth/controller/WithdrawController.kt → ...uth/controller/user/WithdrawController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
hyunsub-auth/src/main/kotlin/kim/hyunsub/auth/model/UserAuthoritySearchResult.kt
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
hyunsub-auth/src/main/kotlin/kim/hyunsub/auth/model/UserInfo.kt
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...m/hyunsub/auth/model/user/ApiAuthority.kt → ...im/hyunsub/auth/model/api/ApiAuthority.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package kim.hyunsub.auth.model.user | ||
package kim.hyunsub.auth.model.api | ||
|
||
data class ApiAuthority( | ||
val id: Int, | ||
|
6 changes: 4 additions & 2 deletions
6
.../kotlin/kim/hyunsub/auth/model/Profile.kt → .../kim/hyunsub/auth/model/api/ApiProfile.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
hyunsub-auth/src/main/kotlin/kim/hyunsub/auth/model/api/ApiUser.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package kim.hyunsub.auth.model.api | ||
|
||
data class ApiUser( | ||
val idNo: String, | ||
val username: String, | ||
val authorities: List<Int>, | ||
) |
5 changes: 0 additions & 5 deletions
5
hyunsub-auth/src/main/kotlin/kim/hyunsub/auth/model/dto/AdminSignOutParams.kt
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
hyunsub-auth/src/main/kotlin/kim/hyunsub/auth/model/dto/ModifyUserAuthorityParams.kt
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
hyunsub-auth/src/main/kotlin/kim/hyunsub/auth/model/dto/UserCreateParams.kt
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
hyunsub-auth/src/main/kotlin/kim/hyunsub/auth/model/dto/admin/AdminUserAuthorityParams.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package kim.hyunsub.auth.model.dto.admin | ||
|
||
data class AdminUserAuthorityParams( | ||
val idNo: String, | ||
val authorityId: Int, | ||
) |
5 changes: 5 additions & 0 deletions
5
hyunsub-auth/src/main/kotlin/kim/hyunsub/auth/model/dto/admin/AdminUserCreateParams.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package kim.hyunsub.auth.model.dto.admin | ||
|
||
data class AdminUserCreateParams( | ||
val name: String, | ||
) |
Oops, something went wrong.