28 lines
351 B
Go
Raw Normal View History

2017-06-07 21:37:13 +00:00
package utils
import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
)
// GetUser ...
func GetUser(ctx *aero.Context) *arn.User {
2017-06-17 20:19:26 +00:00
if !ctx.HasSession() {
return nil
}
2017-06-07 21:37:13 +00:00
userID := ctx.Session().GetString("userId")
if userID == "" {
return nil
}
user, err := arn.GetUser(userID)
if err != nil {
return nil
}
return user
}