-
Notifications
You must be signed in to change notification settings - Fork 31
/
role.go
41 lines (34 loc) · 858 Bytes
/
role.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
package role
import (
"context"
"time"
"github.com/raystack/frontier/pkg/metadata"
)
type State string
func (s State) String() string {
return string(s)
}
const (
Enabled State = "enabled"
Disabled State = "disabled"
)
type Repository interface {
Get(ctx context.Context, id string) (Role, error)
GetByName(ctx context.Context, orgID, name string) (Role, error)
List(ctx context.Context, f Filter) ([]Role, error)
Upsert(ctx context.Context, role Role) (Role, error)
Update(ctx context.Context, toUpdate Role) (Role, error)
Delete(ctx context.Context, roleID string) error
}
type Role struct {
ID string
OrgID string
Name string
Title string
Permissions []string
State State
Scopes []string // used for filtering
Metadata metadata.Metadata
CreatedAt time.Time
UpdatedAt time.Time
}