(ctx *gin.Context)
| 298 | } |
| 299 | |
| 300 | func GetUserIsAdminModerator(ctx *gin.Context) (isAdminModerator bool) { |
| 301 | userInfo, exist := ctx.Get(ctxUUIDKey) |
| 302 | if !exist { |
| 303 | return false |
| 304 | } |
| 305 | u, ok := userInfo.(*entity.UserCacheInfo) |
| 306 | if !ok { |
| 307 | return false |
| 308 | } |
| 309 | if u.RoleID == role.RoleAdminID || u.RoleID == role.RoleModeratorID { |
| 310 | return true |
| 311 | } |
| 312 | return false |
| 313 | } |
| 314 | |
| 315 | func GetLoginUserIDInt64FromContext(ctx *gin.Context) (userID int64) { |
| 316 | userIDStr := GetLoginUserIDFromContext(ctx) |
no test coverage detected