This commit is contained in:
2017-06-23 19:22:39 +02:00
parent 7269bbbaca
commit b5d2cc0465
4 changed files with 16 additions and 38 deletions

View File

@ -5,23 +5,7 @@ import (
"github.com/animenotifier/arn"
)
// GetUser ...
// GetUser returns the logged in user for the given context.
func GetUser(ctx *aero.Context) *arn.User {
if !ctx.HasSession() {
return nil
}
userID := ctx.Session().GetString("userId")
if userID == "" {
return nil
}
user, err := arn.GetUser(userID)
if err != nil {
return nil
}
return user
return arn.GetUserFromContext(ctx)
}