Skip to content

Commit

Permalink
Merge pull request #488 from Permify/docs-improvements
Browse files Browse the repository at this point in the history
docs: expand api
  • Loading branch information
tolgaOzen committed May 16, 2023
2 parents 4967e6b + f621e27 commit c6630a0
Showing 1 changed file with 132 additions and 138 deletions.
270 changes: 132 additions & 138 deletions docs/documentation/docs/api-overview/permission/expand-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ We can use expand API to reason the access actions. If we want to reason access

**Path:** POST /v1/tenants/{tenant_id}/permissions/expand

| Required | Argument | Type | Default | Description |
|----------|----------|---------|---------|-------------------------------------------------------------------------------------------|
| [x] | tenant_id | string | - | identifier of the tenant, if you are not using multi-tenancy (have only one tenant) use pre-inserted tenant `t1` for this field.
| [ ] | schema_version | string | 8 | Version of the schema |
| [ ] | snap_token | string | - | the snap token to avoid stale cache, see more details on [Snap Tokens](../../reference/snap-tokens) |
| [x] | entity | string | - | Name and id of the entity. Example: repository:1”.
| [x] | action | string | - | The action the user wants to perform on the resource |
| Required | Argument | Type | Default | Description |
|----------|----------|---------|---------|----------------------------------------------------------------------------------------------------------------------------------|
| [x] | tenant_id | string | - | identifier of the tenant, if you are not using multi-tenancy (have only one tenant) use pre-inserted tenant `t1` for this field. |
| [ ] | schema_version | string | - | Version of the schema |
| [ ] | snap_token | string | - | the snap token to avoid stale cache, see more details on [Snap Tokens](../../reference/snap-tokens) |
| [x] | entity | string | - | Name and id of the entity. Example: repository:1”. |
| [x] | permission | string | - | The permission the user wants to perform on the resource |

### Expand Push Action

Expand Down Expand Up @@ -153,25 +153,25 @@ We can use expand API to reason the access actions. If we want to reason access

```json
{
"tree": {
"target": {
"entity": {
"type": "repository",
"id": "1"
},
"relation": "owner"
},
"leaf": {
"exclusion": false,
"subjects": [
{
"type": "user",
"id": "1",
"relation": ""
}
]
"tree": {
"target": {
"entity": {
"type": "repository",
"id": "1"
},
"relation": "owner"
},
"exclusion": false,
"leaf": {
"subjects": [
{
"type": "user",
"id": "1",
"relation": ""
}
]
}
}
}
```

Expand All @@ -185,11 +185,15 @@ We can use expand API to reason the access actions. If we want to reason access

```json
{
"entity": {
"type": "repository",
"id": "1"
},
"action": "read"
"metadata": {
"schema_version": "",
"snap_token": ""
},
"entity": {
"type": "repository",
"id": "1"
},
"permission": "read"
}
```

Expand All @@ -201,127 +205,117 @@ We can use expand API to reason the access actions. If we want to reason access

```json
{
"tree": {
"target": null,
"expand": {
"operation": "INTERSECTION",
"tree": {
"target": {
"entity": {
"type": "repository",
"id": "1"
},
"relation": "read"
},
"exclusion": false,
"expand": {
"operation": "OPERATION_INTERSECTION",
"children": [
{
"target": {
"entity": {
"type": "repository",
"id": "1"
},
"relation": "owner"
},
"exclusion": false,
"leaf": {
"subjects": [
{
"type": "user",
"id": "1",
"relation": ""
}
]
}
},
{
"target": {
"entity": {
"type": "repository",
"id": "1"
},
"relation": "read"
},
"exclusion": false,
"expand": {
"operation": "OPERATION_UNION",
"children": [
{
"target": {
{
"target": {
"entity": {
"type": "repository",
"id": "1"
},
"relation": "read"
},
"exclusion": false,
"expand": {
"operation": "OPERATION_UNION",
"children": [
{
"target": {
"entity": {
"type": "repository",
"id": "1"
"type": "organization",
"id": "1"
},
"relation": "owner"
},
"leaf": {
"exclusion": false,
"relation": "admin"
},
"exclusion": false,
"leaf": {
"subjects": [
{
"type": "user",
"id": "1",
"relation": ""
}
{
"type": "user",
"id": "1",
"relation": ""
}
]
}
}
]
}
},
{
"target": {
"entity": {
"type": "repository",
"id": "1"
},
"relation": "read"
},
{
"target": null,
"expand": {
"operation": "UNION",
"children": [
{
"target": null,
"expand": {
"operation": "UNION",
"children": [
{
"target": {
"entity": {
"type": "repository",
"id": "1"
},
"relation": "parent.admin"
},
"leaf": {
"exclusion": false,
"subjects": [
{
"type": "organization",
"id": "1",
"relation": "admin"
}
]
}
},
{
"target": {
"entity": {
"type": "organization",
"id": "1"
},
"relation": "admin"
},
"leaf": {
"exclusion": false,
"subjects": [
{
"type": "user",
"id": "1",
"relation": ""
}
]
}
}
]
}
},
{
"target": null,
"expand": {
"operation": "UNION",
"children": [
{
"target": {
"entity": {
"type": "repository",
"id": "1"
},
"relation": "parent.member"
},
"leaf": {
"exclusion": false,
"subjects": [
{
"type": "organization",
"id": "1",
"relation": "member"
}
]
}
},
{
"target": {
"entity": {
"type": "organization",
"id": "1"
},
"relation": "member"
},
"leaf": {
"exclusion": false,
"subjects": []
}
}
]
}
}
]
"exclusion": false,
"expand": {
"operation": "OPERATION_UNION",
"children": [
{
"target": {
"entity": {
"type": "organization",
"id": "1"
},
"relation": "member"
},
"exclusion": false,
"leaf": {
"subjects": []
}
}
]
}
}
]
}
}
]
}
}
}
```
</p>
Expand Down

0 comments on commit c6630a0

Please sign in to comment.