merge upstream

Signed-off-by: wozulong <>
This commit is contained in:
wozulong
2024-05-15 12:36:29 +08:00
49 changed files with 2313 additions and 845 deletions

View File

@@ -74,6 +74,17 @@ func authHelper(c *gin.Context, minRole int) {
c.Next()
}
func TryUserAuth() func(c *gin.Context) {
return func(c *gin.Context) {
session := sessions.Default(c)
id := session.Get("id")
if id != nil {
c.Set("id", id)
}
c.Next()
}
}
func UserAuth() func(c *gin.Context) {
return func(c *gin.Context) {
authHelper(c, common.RoleCommonUser)