Nimit
11/10/2022, 5:47 PMapiVersion: <http://api.cerbos.dev/v1|api.cerbos.dev/v1>
resourcePolicy:
resource: interactions
version: default
rules:
- actions:
- "*"
roles:
- poweruser
effect: EFFECT_DENY
scoped.yml
apiVersion: <http://api.cerbos.dev/v1|api.cerbos.dev/v1>
resourcePolicy:
resource: interactions
version: default
rules:
- actions:
- VIEW
roles:
- poweruser
effect: EFFECT_ALLOW
scope: T00101581-3dd4-40b8-a2e3-175624586f85
{
"requestId": "123123",
"principal": {
"id": "123",
"roles": [
"poweruser"
],
"attr": {},
"scope": "T00101581-3dd4-40b8-a2e3-175624586f85"
},
"resources": [
{
"resource": {
"kind": "interactions",
"id": "123",
"scope": "T00101581-3dd4-40b8-a2e3-175624586f85",
"attr": {}
},
"actions": [
"VIEW"
]
}
]
}
Alex Olivier (Cerbos)
11/10/2022, 6:01 PMCharith (Cerbos)
11/10/2022, 6:04 PMcat <<EOF | curl --silent "<http://localhost:3592/api/plan/resources?pretty>" -d @-
{
"requestId": "query-plan",
"resource": {
"kind": "interactions",
"scope": "T00101581-3dd4-40b8-a2e3-175624586f85"
},
"principal": {
"id": "123",
"roles": [
"poweruser"
]
},
"action": "CREATE",
"includeMeta": true
}
EOF
{
"requestId": "query-plan",
"action": "CREATE",
"resourceKind": "interactions",
"filter": {
"kind": "KIND_ALWAYS_ALLOWED"
},
"meta": {
"filterDebug": "(true)",
"matchedScope": "T00101581-3dd4-40b8-a2e3-175624586f85"
}
Alex Olivier (Cerbos)
11/10/2022, 6:05 PMNimit
11/10/2022, 7:16 PMc, err := client.New("localhost:3593", client.WithPlaintext())
if err != nil {
log.Fatalf("Error creating Cerbos client: %v", err)
}
roles := []string{"poweruser"}
resp, err := c.PlanResources(context.Background(),
client.NewPrincipal("123").WithRoles(roles...).WithScope("T00101581-3dd4-40b8-a2e3-175624586f85"),
client.NewResource("interactions", "id").WithScope("T00101581-3dd4-40b8-a2e3-175624586f85"),
"VIEW")
fmt.Println(resp.Filter.Kind)
Charith (Cerbos)
11/10/2022, 7:37 PMNimit
11/10/2022, 7:47 PMCharith (Cerbos)
11/11/2022, 8:43 AMmain
branch (go get <http://github.com/cerbos/cerbos/client@main|github.com/cerbos/cerbos/client@main>
)Nimit
11/11/2022, 8:44 AMCharith (Cerbos)
11/14/2022, 1:43 PMmain
until the next release because we are pretty serious about maintaining backward compatibility.Nimit
11/15/2022, 1:28 PMCharith (Cerbos)
11/15/2022, 1:33 PMNimit
11/15/2022, 1:54 PMCharith (Cerbos)
11/15/2022, 2:00 PMv0.22.0
SDK either then?Nimit
11/15/2022, 2:01 PMCharith (Cerbos)
11/15/2022, 2:04 PMNimit
11/15/2022, 2:04 PMCharith (Cerbos)
11/22/2022, 10:56 AM