forked from harness/harness
-
Notifications
You must be signed in to change notification settings - Fork 0
/
member.go
43 lines (35 loc) · 1.18 KB
/
member.go
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package model
import (
"fmt"
)
const (
// Owners can add / remove team members, create / delete projects,
// and have rwx access to all projects owned by the team.
RoleOwner = "Owner"
// Admins can create / delete projects and have rwx acess
// to all projects owned by the team.
RoleAdmin = "Admin"
// Write members have rwx access to all projects
// owned by the team. They may not create new projects.
RoleWrite = "Write"
// Read members have readonly access to all projects
// owned by the team.
RoleRead = "Read"
)
type Role struct {
ID int64 `meddler:"id,pk"`
TeamID int64 `meddler:"team_id"`
UserID int64 `meddler:"user_id"`
Role string `meddler:"role"`
}
type Member struct {
ID int64 `meddler:"user_id"`
Name string `meddler:"name"`
Email string `meddler:"email"`
Gravatar string `meddler:"gravatar"`
Role string `meddler:"role"`
}
// Returns the Gravatar Image URL.
func (m *Member) Image() string { return fmt.Sprintf(GravatarPattern, m.Gravatar, 42) }
func (m *Member) ImageSmall() string { return fmt.Sprintf(GravatarPattern, m.Gravatar, 32) }
func (m *Member) ImageLarge() string { return fmt.Sprintf(GravatarPattern, m.Gravatar, 160) }