-
Notifications
You must be signed in to change notification settings - Fork 126
/
user.go
23 lines (20 loc) · 968 Bytes
/
user.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package auth
import (
"github.com/evergreen-ci/gimlet"
)
type simpleUser struct {
UserId string
Name string
EmailAddress string
APIKey string
SiteRoles []string
}
func (u *simpleUser) DisplayName() string { return u.Name }
func (u *simpleUser) Email() string { return u.EmailAddress }
func (u *simpleUser) Username() string { return u.UserId }
func (u *simpleUser) IsNil() bool { return u == nil }
func (u *simpleUser) GetAPIKey() string { return u.APIKey }
func (u *simpleUser) GetAccessToken() string { return "" }
func (u *simpleUser) GetRefreshToken() string { return "" }
func (u *simpleUser) Roles() []string { out := []string{}; copy(out, u.SiteRoles); return out }
func (u *simpleUser) HasPermission(gimlet.PermissionOpts) bool { return true }