Debian Codegraph @

trustgraph/graph.go

raw symbols SCIP
1 package trustgraph
2
3 import "github.com/containers/libtrust"
4
5 // TrustGraph represents a graph of authorization mapping
6 // public keys to nodes and grants between nodes.
7 type TrustGraph interface {
8 // Verifies that the given public key is allowed to perform
9 // the given action on the given node according to the trust
10 // graph.
11 Verify(libtrust.PublicKey, string, uint16) (bool, error)
12
13 // GetGrants returns an array of all grant chains which are used to
14 // allow the requested permission.
15 GetGrants(libtrust.PublicKey, string, uint16) ([][]*Grant, error)
16 }
17
18 // Grant represents a transfer of permission from one part of the
19 // trust graph to another. This is the only way to delegate
20 // permission between two different sub trees in the graph.
21 type Grant struct {
22 // Subject is the namespace being granted
23 Subject string
24
25 // Permissions is a bit map of permissions
26 Permission uint16
27
28 // Grantee represents the node being granted
29 // a permission scope. The grantee can be
30 // either a namespace item or a key id where namespace
31 // items will always start with a '/'.
32 Grantee string
33
34 // statement represents the statement used to create
35 // this object.
36 statement *Statement
37 }
38
39 // Permissions
40 // Read node 0x01 (can read node, no sub nodes)
41 // Write node 0x02 (can write to node object, cannot create subnodes)
42 // Read subtree 0x04 (delegates read to each sub node)
43 // Write subtree 0x08 (delegates write to each sub node, included create on the subject)
44 //
45 // Permission shortcuts
46 // ReadItem = 0x01
47 // WriteItem = 0x03
48 // ReadAccess = 0x07
49 // WriteAccess = 0x0F
50 // Delegate = 0x0F