-
Notifications
You must be signed in to change notification settings - Fork 1
/
model.go
34 lines (27 loc) · 919 Bytes
/
model.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
package sdk
// EntityIDToPolicies maps an entity ID to a slice of policies.
type EntityIDToPolicies map[string][]Policy
// Bundle is the optimised lookup table for permissions.
type Bundle map[string]EntityIDToPolicies
// Policy is the policy model as stored in the permissions API.
type Policy struct {
ID string `json:"id"`
Condition Condition `json:"condition"`
}
// Condition is used within a policy to match additional attributes.
type Condition struct {
Attribute string `json:"attribute"`
Operator Operator `json:"operator"`
Values []string `json:"values"`
}
// Operator is used to define a set of supported Condition operators
type Operator string
// EntityData groups the different entity types into a single parameter
type EntityData struct {
UserID string
Groups []string
}
const (
OperatorStringEquals Operator = "StringEquals"
OperatorStartsWith Operator = "StartsWith"
)