What are Users?
Users are individual accounts that can authenticate and access Directus. Each user has a unique email address, password (or authentication method), and is assigned to one or more roles that determine their permissions and access levels.Users are stored in the
directus_users system collection and can be managed through the API or admin interface.User Structure
Users have both required system fields and optional profile information:Required Fields
id- Unique identifier (UUID)email- Unique email address (case-insensitive)password- Hashed passwordrole- Assigned role IDstatus- Account status (active,suspended,draft,invited)provider- Authentication provider (default,ldap,oauth, etc.)
Optional Fields
first_name- User’s first namelast_name- User’s last nameavatar- Profile image (file ID)language- Preferred interface languagetheme- App theme preference (auto,light,dark)tfa_secret- Two-factor authentication secretemail_notifications- Enable email notificationstitle- Job titledescription- User bio/descriptiontags- Organizational tagslocation- Geographic location
Creating Users
Via API
~/workspace/source/api/src/services/users.ts:190-200), creating a user:
- Validates email uniqueness (case-insensitive)
- Checks password against password policy
- Hashes the password securely
- Creates the user record
- Triggers user creation hooks
Email Validation
From the source code (~/workspace/source/api/src/services/users.ts:50-80):
Password Policies
From the source code (~/workspace/source/api/src/services/users.ts:87-118), passwords are validated against configurable policies:
User Status
Users can have different statuses:Active
Invited
Draft
Suspended
Inviting Users
Send invitation emails to new users:~/workspace/source/api/src/services/users.ts:153-164), the invitation process:
- Creates a user with
status: invited - Generates a JWT token with email and
scope: invite - Sends invitation email with acceptance link
- Token expires based on
USER_INVITE_TOKEN_TTLsetting
What are Roles?
Roles are groups that define shared permissions and access levels. Users are assigned to roles, which in turn are associated with policies containing permissions.Role Structure
Admin Roles
Roles withadmin_access: true bypass all permission checks:
Admin users have unrestricted access to all collections, fields, and items. Use this carefully.
App Access
Roles withapp_access: true can access the Directus admin application:
Creating Roles
~/workspace/source/api/src/services/roles.ts:13-19), role creation is straightforward but changes to roles trigger cache clearing and user integrity checks.
Role Inheritance
Roles can inherit from parent roles:~/workspace/source/api/src/services/roles.ts:108-119), role nesting is validated to prevent circular references:
Policies and Access
Roles are linked to policies through thedirectus_access collection:
Deleting Roles
From the source code (~/workspace/source/api/src/services/roles.ts:46-106), deleting a role:
- Deletes all permissions associated with the role’s policies
- Deletes all presets for the role
- Suspends all users assigned to the role
- Sets users’ role to NULL
- Updates child roles to remove parent reference
Authentication Providers
Users can authenticate through multiple providers:Default Provider
LDAP Provider
OAuth Providers
Two-Factor Authentication
Enabling TFA
Enforcing TFA
Roles can require TFA for all users:IP Access Restrictions
Limit role access to specific IP addresses:User Sessions
From the source code (~/workspace/source/api/src/services/users.ts:123-133), user sessions can be cleared:
- Forcing users to re-authenticate
- Security incidents
- Role/permission changes
Common Use Cases
Content Team
Create Editor, Reviewer, and Publisher roles with progressive permissions for content workflows.
API Clients
Set up API-only roles without app access for external system integrations.
Department Access
Create department-specific roles with conditional permissions based on user attributes.
Customer Portal
Build customer-facing roles with limited access to their own data and public content.
Best Practices
Related Concepts
- Permissions - Access control rules assigned to roles
- Collections - Data that users and roles can access
- Items - Records that users create and manage