-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.go
More file actions
33 lines (29 loc) · 769 Bytes
/
Copy pathhelpers.go
File metadata and controls
33 lines (29 loc) · 769 Bytes
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
package canery
// User returns a Subject for a human user actor.
//
// It is a convenience helper. Generic package usage should prefer Actor when a
// user-specific helper is not materially clearer.
func User(id string) Subject {
return Actor("user", id)
}
// Actor returns a Subject for the given actor kind and identifier.
func Actor(kind string, id string) Subject {
return Subject{
Type: kind,
ID: id,
}
}
// Resource returns a ResourceRef for the given resource kind and identifier.
func Resource(kind string, id string) ResourceRef {
return ResourceRef{
Type: kind,
ID: id,
}
}
// Scope returns a ScopeRef for the given scope kind and identifier.
func Scope(kind string, id string) ScopeRef {
return ScopeRef{
Type: kind,
ID: id,
}
}