Roles are the central mechanism for controlling access in Reeflow. A role bundles permissions with user attribute rules, defining both what a principal can do and what context they must provide.
Permissions: Actions the role can perform on specific resources. See Permissions.
Required user attributes:User attributes a principal must provide to assume the role. If missing, the role is skipped entirely.
Fixed user attributes: Values the role provides, overriding any value the principal supplies. Use these to enforce constraints that principals cannot bypass.
Principals: Entities that can be assigned roles: teams, API keys, and embedded users.
When a principal makes a request, Reeflow resolves their effective permissions and user attributes in three steps:
Resolve assumable roles: Identify which of the principal’s assigned roles they can assume. A role is assumable only if the principal provides all its required user attributes. Roles without required user attributes are always assumable.
Merge permissions: Combine permissions from all assumable roles using union semantics. If any role grants an action, the principal can perform it.
Resolve user attributes: Start with the principal’s user attributes, then apply fixed user attributes from each assumable role. Fixed values override the principal’s values.
An embedded user has a role that requires tenant_id and grants query access to the orders table with a row filter tenant_id = RF_USER_ATTR('tenant_id').
The principal provides tenant_id = 'acme' in their session token:
Role resolved: The role applies because tenant_id is provided.
User attributes resolved:tenant_id = 'acme'.
Result: Queries to orders are rewritten to SELECT * FROM orders WHERE tenant_id = 'acme'. Only Acme’s rows are returned.
Roles can configure user attributes in two ways to enforce security constraints.
Type
Purpose
Behavior
Required
Ensure context is present before granting access
Role is skipped if the principal does not provide the user attribute
Fixed
Enforce a specific value that principals cannot override
Value is set by the role, ignoring any value the principal provides
A user attribute cannot be both required and have a fixed value on the same role. Required user attributes expect the principal to supply a value; fixed user attributes supply the value themselves.
Example: Fixed user attributes override principal values
Create a new role to define permissions and user attribute requirements for principals. This guide shows how to create a role with a required user attribute for multi-tenant security.
Navigate to Roles in the main navigation, then click New Role to open the form.
Enter a Name for the role. Choose a descriptive name that indicates what access the role provides.
Optionally add a Description to explain the role’s purpose and when to assign it.
Expand User Attributes and click Add Attribute. Select an attribute key and set it as Required. Principals must provide this attribute to assume the role.
Expand Connections and enable the Query action to allow data access. You can configure connection scope, table access, and row filters from here.
Click Create Role to save. The role now appears in the list and can be assigned to principals.
Navigate to Roles in the main navigation, then click New Role to open the form.
Enter a Name for the role. Choose a descriptive name that indicates what access the role provides.
Optionally add a Description to explain the role’s purpose and when to assign it.
Expand User Attributes and click Add Attribute. Select an attribute key and set it as Required. Principals must provide this attribute to assume the role.
Expand Connections and enable the Query action to allow data access. You can configure connection scope, table access, and row filters from here.
Click Create Role to save. The role now appears in the list and can be assigned to principals.
For configuring query permissions (connections, tables, columns, and row filters), see:
Reeflow enforces the following constraints on roles:
Constraint
Limit
Name length
100 characters
Description length
500 characters
User attributes per role
10
Row constraints per table
10
User attribute keys referenced in role configuration must be defined in the organization. Attempting to use an undefined user attribute key returns an error.