Skip to main content

Roles

The Roles tab provides a centralized view for managing user roles across all auth collections in your project. Access it from the top navigation bar in any project.

Roles Table

The table displays all roles from every auth collection:

ColumnDescription
NameDisplay name of the role
CodeIdentifier used in code and permissions
ProjectProject the role belongs to
Auth CollectionWhich auth collection contains this role
ActionEdit or delete the role

Use the search bar to filter roles by name or code.

Creating a Role

  1. Click Add Role in the top right

  2. Configure Basic Settings:

    • Name - Display name (e.g., "Manager")
    • Code - Unique identifier (e.g., "manager")
    • Auth Collection - Select which auth collection this role belongs to
  3. Configure Advanced Settings (optional):

    • Add conditions to automatically assign roles based on session data
  4. Click Submit

Role Conditions

Advanced settings let you define conditions for automatic role assignment. Conditions use session fields - the data stored when a user logs in. Configure session fields in each auth collection's Profile & Session settings.

FieldDescription
ConjunctionLogical operator: WHERE, AND, OR
Session FieldField from user session to evaluate
OperatorComparison type (see below)
Value InputValue to compare against

Available Operators

OperatorDescription
is equal toExact match
is not equal toDoes not match
Greater thanNumeric comparison
Less thanNumeric comparison
Greater than or equal toNumeric comparison
Less than or equal toNumeric comparison
Is nullField has no value
Not nullField has a value
Is trueBoolean true
Is falseBoolean false
IncludeContains value in array

Building Conditions

Combine multiple conditions using conjunctions:

  • WHERE - Starts a condition chain
  • AND - Both conditions must be true
  • OR - Either condition can be true

Example: A "Manager" role with condition WHERE role is equal to manager assigns this role to users whose session contains role: "manager".

Session Fields

The Session Field dropdown shows fields configured in each auth collection's session settings. Common fields include:

  • role - User's role value for permission checks
  • username - Display name
  • userId - Unique identifier

See Profile & Session for configuring which fields are available in sessions.

Managing Roles

Editing a Role

Click the edit icon (pencil) in the Action column to modify:

  • Role name and code
  • Auth collection assignment
  • Role conditions

Deleting a Role

Click the delete icon (trash) in the Action column. Confirm the deletion when prompted.

warning

Deleting a role removes it from all users who have it assigned. Ensure no active permissions depend on the role before deletion.

Next Steps