Add FindByAny, Stringer for users

This commit is contained in:
Denis Arh
2020-01-18 07:05:34 +01:00
parent 95b49e7061
commit e7504dd35f
4 changed files with 31 additions and 0 deletions
+8
View File
@@ -1,5 +1,9 @@
package auth
import (
"fmt"
)
type (
Identity struct {
id uint64
@@ -30,6 +34,10 @@ func (i Identity) Valid() bool {
return i.id > 0
}
func (i Identity) String() string {
return fmt.Sprintf("%d", i.id)
}
func NewSuperUserIdentity() *Identity {
return NewIdentity(superUserID)
}
+1
View File
@@ -9,6 +9,7 @@ type (
Identity() uint64
Roles() []uint64
Valid() bool
String() string
}
TokenEncoder interface {