forked from AWaterColorPen/caskin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentry.go
More file actions
85 lines (70 loc) · 1.17 KB
/
entry.go
File metadata and controls
85 lines (70 loc) · 1.17 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package caskin
type ObjectType string
type Action string
const (
Read Action = "read"
Write Action = "write"
)
type Policy struct {
Role Role
Object Object
Domain Domain
Action Action
}
type RolesForUser struct {
User User `json:"user"`
Roles []Role `json:"roles"`
}
type UsersForRole struct {
Role Role `json:"role"`
Users []User `json:"users"`
}
type entry interface {
// get id method
GetID() uint64
// get id method
SetID(uint64)
// encode entry to string method
Encode() string
// decode string to entry method
Decode(string) error
// is object method
IsObject() bool
// get object string method
GetObject() string
}
type parent interface {
// get parent id method
GetParentID() uint64
// set parent id method
SetParentID(uint64)
}
type inDomain interface {
// set domain id method
SetDomainID(uint64)
}
type parentEntry interface {
entry
parent
}
type User interface {
entry
}
type Role interface {
parentEntry
inDomain
}
type Object interface {
parentEntry
inDomain
GetObjectType() ObjectType
}
type Domain interface {
entry
}
type EntryFactory interface {
NewUser() User
NewRole() Role
NewObject() Object
NewDomain() Domain
}