29 lines
495 B
Go
Raw Normal View History

2017-06-07 21:37:13 +00:00
package utils
import (
"github.com/aerogo/aero"
2019-06-03 09:32:43 +00:00
"github.com/animenotifier/notify.moe/arn"
2017-06-07 21:37:13 +00:00
)
2017-06-23 17:22:39 +00:00
// GetUser returns the logged in user for the given context.
2019-06-01 04:55:49 +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"
}