Directus (flagbit) icon

Directus (flagbit)

Consume Directus API

Permission → Create Multiple

AI-generated

Overview

This node operation allows creating multiple permission objects in the Directus system at once. It is useful for batch setting up or updating access controls for various collections, actions, roles, and fields in a single API call. For example, you can define multiple permissions for different roles on collections like 'pages' with specific actions such as 'read' or 'create' and specify which fields are accessible.

Use Case Examples

  1. Creating multiple permissions for a role to read and create entries in the 'pages' collection, specifying accessible fields like 'id' and 'title'.
  2. Batch updating permissions for different roles and collections to streamline access control management.

Properties

Name Meaning
Data (JSON) An array of partial permission objects to be created. Each object must include 'action' and 'collection' fields, and can specify 'role' and 'fields' to define the permission scope.

Output

JSON

  • id - The unique identifier of the created permission object.
  • collection - The collection to which the permission applies.
  • action - The action allowed by the permission (e.g., read, create).
  • role - The role to which the permission is assigned.
  • fields - The specific fields within the collection that the permission covers.

Dependencies

  • Requires an API key credential for Directus to authenticate and authorize the creation of permissions via the Directus API.

Troubleshooting

  • Ensure the JSON data array is correctly formatted and includes required fields 'action' and 'collection' for each permission object.
  • Verify that the API key credential has sufficient permissions to create permissions in Directus.
  • Common error messages may include validation errors if required fields are missing or if the role or collection specified does not exist. Check the Directus API documentation for detailed error codes and messages.

Links

Discussion