forked from spaceweasel/mango
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathidentity.go
More file actions
28 lines (22 loc) · 852 Bytes
/
identity.go
File metadata and controls
28 lines (22 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package mango
// Identity is the interface used to hold information of the user
// making the request. Implementations of Identity are should to created
// and populated in a pre-hook.
type Identity interface {
UserID() string
Email() string
Fullname() string
Organization() string
}
// BasicIdentity is a basic implementation of the Identity interface.
type BasicIdentity struct {
Username string
}
// UserID returns the ID of the request user
func (i BasicIdentity) UserID() string { return i.Username }
// Email returns the email address of the request user
func (i BasicIdentity) Email() string { return "" }
// Fullname returns the fullname of the request user
func (i BasicIdentity) Fullname() string { return "" }
// Organization returns the organization of the request user
func (i BasicIdentity) Organization() string { return "" }