coldbox-security-rbac

Implement role-based access control for ColdBox applications with database schemas.

1|Updated Apr 10, 2026
One-click install
npx skills add https://github.com/ColdBox/skills --skill coldbox-security-rbac
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: coldbox-security-rbac
Source: https://github.com/ColdBox/skills/tree/main/security/rbac-patterns
Command: npx skills add https://github.com/ColdBox/skills --skill coldbox-security-rbac

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Centralizes access control by replacing ad-hoc permission checks with a role-and-permission model so teams can consistently enforce who can view, modify, or manage application resources.

Core Features & Use Cases

  • Persistent Role & Permission Storage: Database schema for roles, permissions, role_permissions pivot, and user_roles pivot to store RBAC data.
  • Role and User Services: RoleService and UserService patterns for creating roles, assigning permissions, assigning/removing roles from users, and resolving effective permissions including hierarchical inheritance.
  • Handler and Route Enforcement: Examples showing handler-level checks using cbsecurity, CBSecurity rules for route-level protection, and patterns for protecting sensitive actions like deleting admin users.
  • Use Case: Protect an admin dashboard and critical endpoints in a CMS by defining viewer/editor/admin roles, assigning permissions, and enforcing checks both in handlers and in module settings.

Quick Start

Create roles with RoleService, assign permissions and user roles with UserService, then check permissions inside handlers using cbsecurity.can before executing sensitive actions.

Frequently Asked Questions about coldbox-security-rbac

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement role-based access control in a ColdBox application?

To implement role-based access control in a ColdBox application, you define database schemas for roles and permissions, use pivot tables for assignments, and enforce checks in handlers and routes using CBSecurity rules.

How does hierarchical role inheritance work for resolving effective permissions in ColdBox?

Hierarchical role inheritance resolves effective permissions by allowing higher-level roles to pass down their permissions to lower-level roles. The UserService evaluates assigned user roles and aggregates permissions hierarchically during access checks.

What is the best way to structure a database schema for RBAC permissions?

The best way to structure an RBAC database schema for permissions is to create dedicated tables for roles and permissions, alongside pivot tables like role_permissions and user_roles to manage many-to-many relationships and effective permission resolution.

Can I use CBSecurity rules to protect ColdBox routes and handlers with role checks?

Yes, you can use CBSecurity rules to protect ColdBox routes and handlers with role checks. The framework integrates role-based access control directly into module routing configurations and handler-level pre-checks for sensitive actions.

Do I need dependency injection to manage user roles and permissions in ColdBox?

Yes, you need dependency injection to manage user roles and permissions in ColdBox. The framework relies on injected RoleService and UserService components to handle role creation, user assignments, and effective permission resolution.

What are the limitations of replacing ad-hoc permission checks with a full RBAC model?

A limitation of replacing ad-hoc permission checks with a full RBAC model is the initial setup overhead, requiring predefined database schemas for roles, permissions, and pivot tables before you can enforce access control rules consistently.