Manage Resources
A new resource of type
folder
was created in your application.
Managing resources means notifying Space Cloud about the creation, update, or deletion of resources in your application, so that they can be included in calculating permissions for them.
Register resources in Space Cloud to manage permissions for them.
Flow
Scenario: User Bob creates a new folder called Foo in tenant Bar of your application.
➊ Your Backend notifies Space Blocks, that user Bob created a new Resource of Resource Type folder
called Foo in tenant Bar.
➋ Space Blocks confirms.
Usage
- API
To manage resources,resource, use the CreateResource, UpdateResource, and DeleteResource API operations.
Tenants are technically also resources, but they have their own API operations. To manage tenants, use the CreateTenant, UpdateTenant, and DeleteTenant API operations.
/tenants/<TENANT_ID>/resource/<RESOURCE_ID>
for resources/tenants/<TENANT_ID>
for tenants
Examples:
/tenants/456/resource/folder
for resources/tenants/456
for tenants
Request:
curl -i --location "https://<YOUR_API_URL>/management/tenants/<TENANT_ID>/resources/<RESOURCE_TYPE_ID>" \
--request POST \
--header "Content-Type: application/json" \
--header "Authentication: Bearer <YOUR_ACCESS_TOKEN>" \
--header "apiKey: <YOUR_API_KEY>"
--data '{
"id": "<RESOURCE_ID>",
"name": "<RESOURCE_NAME>"
}'