capabilities call over the whole documentA shop matrix over two object kinds. Load it, change a rule, and watch the decisions move. Or paste your own into the box on the left.
{
"version": "shop@12",
"maxStale": 900000,
"schema": {
"subject": {
"fields": {
"id": "string",
"roles": "string[]"
}
},
"objects": {
"listing": {
"fields": {
"id": "string",
"sellerId": "string",
"status": "string",
"title": "string",
"price": "number"
}
},
"order": {
"fields": {
"id": "string",
"buyerId": "string",
"placedAt": "instant"
}
}
}
},
"permissions": [
{
"key": "listing.read",
"object": "listing",
"action": "read",
"visibility": "public",
"rules": [
{
"id": "anyone",
"when": []
}
]
},
{
"key": "listing.update",
"object": "listing",
"action": "update",
"visibility": "public",
"rules": [
{
"id": "seller",
"when": [
{
"field": "object.sellerId",
"op": "eq",
"path": "subject.id"
}
]
}
],
"denyRules": [
{
"id": "archived",
"when": [
{
"field": "object.status",
"op": "eq",
"value": "archived"
}
]
}
],
"fields": {
"fields": [
"*",
"!sellerId"
]
}
},
{
"key": "order.refund",
"object": "order",
"action": "refund",
"rules": [
{
"id": "support",
"when": [
{
"field": "subject.roles",
"op": "contains",
"value": "support"
}
]
}
]
}
]
}