MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / ValidateAccessToken

Function ValidateAccessToken

model/user.go:556–566  ·  view source on GitHub ↗

IsUserEnabled checks user status from Redis first, falls back to DB if needed func IsUserEnabled(id int, fromDB bool) (status bool, err error) { defer func() { // Update Redis cache asynchronously on successful DB read if shouldUpdateRedis(fromDB, err) { gopool.Go(func() { if err := upda

(token string)

Source from the content-addressed store, hash-verified

554//}
555
556func ValidateAccessToken(token string) (user *User) {
557 if token == "" {
558 return nil
559 }
560 token = strings.Replace(token, "Bearer ", "", 1)
561 user = &User{}
562 if DB.Where("access_token = ?", token).First(user).RowsAffected == 1 {
563 return user
564 }
565 return nil
566}
567
568// GetUserQuota gets quota from Redis first, falls back to DB if needed
569func GetUserQuota(id int, fromDB bool) (quota int, err error) {

Callers 1

authHelperFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected