29 lines
485 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"
)
2017-06-23 17:22:39 +00:00
// GetUser returns the logged in user for the given context.
2017-06-07 21:37:13 +00:00
func GetUser(ctx *aero.Context) *arn.User {
2017-06-23 17:22:39 +00:00
return arn.GetUserFromContext(ctx)
2017-06-07 21:37:13 +00:00
}
2017-06-30 21:52:42 +00:00
// SameUser returns "true" or "false" depending on if the users are the same.
func SameUser(a *arn.User, b *arn.User) string {
if a == nil {
return "false"
}
if b == nil {
return "false"
}
if a.ID == b.ID {
return "true"
}
return "false"
}