Skip to main content
Version: 2.0.0

updateResource

Updates a resource for the specific resource key or id.

Parameters

resourceId - The unique resource key or the resource id.
resource - An object that contains the information about the updated resource. The payload is defined below.

Payload

name - optional - The name of the resource.
urn - optional - The URN(Uniform Resource Name) of the resource.
description - optional - An optional longer description of what this resource respresents in your system.
actions - optional - A actions definition block, typically contained within a resource type definition block. The actions represents the ways you can interact with a protected resource.
attributes - optional - Attributes that each resource of this type defines, and can be used in your ABAC policies.
roles - optional - Roles defined on this resource. The key is the role name, and the value contains the role properties such as granted permissions, base roles, etc.
relations - optional - Relations to other resources. The key is the relation name, and the value is the destination resource.

{
name: "name",
urn: "urn",
description: "description",
actions: {},
attributes: {},
roles: {},
relations: {}
}

Implementation

const response = await permit.api.updateResource(
resourceId,
JSON.stringify(resource)
);