-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathoptions.go
52 lines (39 loc) · 862 Bytes
/
options.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
44
45
46
47
48
49
50
51
52
package engine
type Type int
const (
CasbinEngine Type = 1
OpaEngine Type = 2
)
type Subject string
type Subjects []Subject
func MakeSubjects(subs ...Subject) Subjects {
return subs
}
type Project string
type Projects []Project
func MakeProjects(projects ...Project) Projects {
return projects
}
type Action string
type Actions []Action
func MakeActions(actions ...Action) Actions {
return actions
}
type Resource string
type Resources []Resource
func MakeResources(resources ...Resource) Resources {
return resources
}
type Pair struct {
Resource Resource `json:"resource"`
Action Action `json:"action"`
}
type Pairs []Pair
func MakePair(res, act string) Pair {
return Pair{Resource(res), Action(act)}
}
func MakePairs(pairs ...Pair) Pairs {
return pairs
}
type PolicyMap map[string]interface{}
type RoleMap map[string]interface{}