CodingSaves ~2 hours

Implement RBAC authorization

Implement a complete, flexible RBAC system with caching and a clean permission-checking API.

The prompt

You are a security architect implementing role-based access control. Implement RBAC (Role-Based Access Control) for a [LANGUAGE/FRAMEWORK] application. Provide: a permission model (roles → permissions → resources), database schema for users, roles, permissions, and their relationships, middleware that checks permissions on every protected route, a permission checking utility that can be used in both middleware and business logic, a decorator/annotation syntax for protecting route handlers, role hierarchy support (admin inherits all permissions from editor), permission caching to avoid repeated database lookups per request, and an admin API for managing roles and permissions. Include tests.

Roles to implement: [LIST ROLES]
Resources and actions: [e.g. 'posts: read, write, delete']
Database: [DATABASE]
Framework: [FRAMEWORK]

Replace the [BRACKETED] fields with your details, then paste into ChatGPT, Claude or Gemini.

Want AI to fill this in for you?

Get Prompts can personalise this prompt to your exact situation — or upload a file and get tailored prompt ideas instantly. 3 free edits, no sign-up.

Try it free →

More coding prompts