Add FindByAny, Stringer for users
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ type (
|
||||
Identity() uint64
|
||||
Roles() []uint64
|
||||
Valid() bool
|
||||
String() string
|
||||
}
|
||||
|
||||
TokenEncoder interface {
|
||||
|
||||
Reference in New Issue
Block a user