A lightweight, multi-role, whitelist-based authorization gem for Rails and other Ruby applications.
AccessGranted is a lightweight authorization gem for Ruby on Rails and other Ruby applications. It provides a multi-role, whitelist-based system for defining permissions, solving common pain points like performance issues and convoluted policy files. It serves as a modern replacement for CanCan with improved speed and cleaner syntax.
Ruby on Rails developers and teams needing a performant, maintainable authorization solution, especially those transitioning from CanCan or building applications with complex role-based access control requirements.
Developers choose AccessGranted for its significant performance gains over CanCan, intuitive role-based permission structure, and framework-agnostic design. Its whitelist approach ensures policies are explicit and easy to reason about, reducing bugs and maintenance overhead.
Multi-role and whitelist based authorization gem for Rails (and not only Rails!)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Benchmarks show it's 20 times faster than CanCan with lower memory usage, ideal for high-traffic Rails apps.
Multi-role support with top-to-bottom evaluation eliminates complex conditional logic, making policies readable and maintainable.
Permissions are defined only as allowed actions, reducing bugs and improving predictability as app complexity grows.
Zero runtime dependencies ensure it works with any Ruby object, though Rails helpers are included for convenience.
Lacks CanCan's accessible_by? method, requiring manual implementation for database-level permission scopes, which can be tedious for data-intensive apps.
Roles must be defined in precise precedence order; incorrect ordering can silently break authorization logic and is error-prone.
Permissions are defined in code at load time, making real-time role or permission changes difficult without application restarts or complex workarounds.
AccessGranted is an open-source alternative to the following products: