Role-based and attribute-based access control (RBAC + ABAC) for nself applications. Define roles, permissions, policies, and authorize requests with wildcard matching, role hierarchies, and conditional evaluation.
Property
Value
Port
3027
Category
authentication
Multi-App
source_account_id (UUID)
Min nself
0.4.8
Quick Start
# Initialize the database schema
nself plugin run access-controls init
# Start the server
nself plugin run access-controls server
# Or with custom port
nself plugin run access-controls server --port 3027
Configuration
Required Environment Variables
Variable
Description
DATABASE_URL
PostgreSQL connection string
Optional Environment Variables
Variable
Default
Description
ACL_PLUGIN_PORT
3027
Server port
ACL_PLUGIN_HOST
0.0.0.0
Server host
ACL_CACHE_TTL_SECONDS
300
Permission cache TTL (seconds)
ACL_MAX_ROLE_DEPTH
10
Maximum role hierarchy depth
ACL_DEFAULT_DENY
true
Deny by default when no matching permission
ACL_API_KEY
-
API key for authentication
ACL_RATE_LIMIT_MAX
200
Max requests per window
ACL_RATE_LIMIT_WINDOW_MS
60000
Rate limit window (ms)
CLI Commands
Command
Description
init
Initialize database schema (creates all tables and indexes)
server
Start the HTTP API server (-p/--port, -h/--host)
status
Show role/permission/policy counts and statistics
roles
Manage roles: list, create <name>, show <id>, delete <id>
Standard webhook event tracking table with id, source_account_id, event_type, payload (JSONB), processed, processed_at, error, created_at.
Role Hierarchy
Roles support single-parent inheritance. When evaluating permissions, the engine walks up the role tree using a recursive CTE:
admin
-> editor
-> viewer
A user with the editor role inherits all permissions from viewer. A user with admin inherits from both editor and viewer.
Maximum hierarchy depth is configurable via ACL_MAX_ROLE_DEPTH (default: 10).
Troubleshooting
Authorization always denied -- Check ACL_DEFAULT_DENY is set as intended, verify the user has roles assigned, verify the role has permissions assigned, and check role hierarchy via parent_role_id.
Cache returning stale results -- Use POST /v1/cache/invalidate to clear cache, or reduce ACL_CACHE_TTL_SECONDS.
Wildcard permissions not matching -- Wildcard * matches any single segment: users:* matches users:read but not users:admin:read.