Actions100
- Activity Actions
- Asset Actions
- Authentication Actions
- Collection Actions
- Extension Actions
- Field Actions
- File Actions
- Folder Actions
- Item Actions
- Permission Actions
- Preset Actions
- Relation Actions
- Revision Actions
- Role Actions
- Setting Actions
- User Actions
- Utility Actions
Overview
This node creates a new permission rule in a Directus instance. It is designed to allow users to define what actions (such as create, read, update, or delete) are permitted on a specific collection within Directus. This is useful for managing access control and ensuring that only authorized users or roles can perform certain operations on your data.
Common scenarios:
- Setting up granular access controls for different user roles.
- Automating the creation of permissions when onboarding new collections.
- Integrating with workflows that require dynamic permission management.
Practical example:
Automatically grant "create" permissions to a "customers" collection for a newly created role.
Properties
Name | Meaning |
---|---|
Collection Name | The name of the collection this permission applies to. You select from available collections (e.g., "customers"). |
Action | The CRUD operation this permission rule applies to. Options: Create, Read, Update, Delete. |
JSON/RAW Parameters | Whether to set query/body parameters via the value-key pair UI (false) or provide them directly as JSON/RAW (true). |
Body Parameters | The body parameters for the permission rule, provided as JSON or RAW. Only shown if "JSON/RAW Parameters" is enabled. |
Output
The output will be a JSON object representing the newly created permission rule in Directus. The structure typically includes fields such as:
{
"id": "unique-permission-id",
"collection": "customers",
"action": "create",
"role": "role-id-or-null",
"permissions": { /* permission details as defined in Body Parameters */ },
"fields": [/* list of fields affected, if specified */],
"validation": {/* validation rules, if any */},
"presets": {/* preset values, if any */},
"status": "active"
}
Note: The exact structure depends on the Directus API response and the contents of your Body Parameters.
Dependencies
- Directus instance: You must have access to a running Directus server.
- API Key or Authentication: Proper authentication credentials (API key, token, or session) are required to interact with the Directus API.
- n8n Configuration: The node may require configuration of credentials for Directus within n8n.
Troubleshooting
Common issues:
- Invalid Collection Name: If the specified collection does not exist, the node will fail. Double-check the collection name.
- Insufficient Permissions: If the API credentials do not have rights to manage permissions, you may receive an authorization error.
- Malformed JSON in Body Parameters: If using JSON/RAW mode, ensure your JSON is valid. Errors here will cause the node to fail.
- Missing Required Fields: Ensure all required fields in the Body Parameters are provided according to Directus API documentation.
Error messages and resolutions:
"Collection not found"
: Verify the collection name exists in your Directus instance."Unauthorized"
or"Forbidden"
: Check your API credentials and permissions."Invalid JSON"
: Validate your JSON syntax in the Body Parameters field.