Finish system log

This commit is contained in:
2023-10-19 16:01:42 +08:00
parent 63daa8d801
commit 1d77caf390
6 changed files with 145 additions and 34 deletions

View File

@@ -6,9 +6,10 @@ import top.fatweb.api.constant.SecurityConstants
import top.fatweb.api.entity.permission.LoginUser
object WebUtil {
fun getLoginUser() = SecurityContextHolder.getContext().authentication.principal as LoginUser
fun getLoginUser() = if (SecurityContextHolder.getContext().authentication.principal is String) null
else SecurityContextHolder.getContext().authentication.principal as LoginUser
fun getLoginUserId() = getLoginUser().user.id
fun getLoginUserId() = getLoginUser()?.user?.id
fun getToken(tokenWithPrefix: String) = tokenWithPrefix.removePrefix(SecurityConstants.tokenPrefix)