feat: 系统用户免登录认证,默认为admin操作所有接口
This commit is contained in:
@@ -26,9 +26,6 @@ func CryptoApi(requestDecrypt, responseEncrypt bool) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
// 登录认证,默认打开
|
||||
enable := true
|
||||
if v := config.Get("user.loginAuth"); v != nil {
|
||||
enable = v.(bool)
|
||||
}
|
||||
if v := config.Get("user.cryptoApi"); v != nil && enable {
|
||||
enable = v.(bool)
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ func PreAuthorize(options map[string][]string) gin.HandlerFunc {
|
||||
loginUser.UserID = "2"
|
||||
loginUser.User.UserID = "2"
|
||||
loginUser.User.UserName = "admin"
|
||||
loginUser.User.NickName = "admin"
|
||||
c.Set(commonConstants.CTX_LOGIN_USER, loginUser)
|
||||
c.Next()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user