A Rails authorization gem offering easy-to-read action and content-based permissions with a straightforward syntax.
Petergate is a Ruby on Rails authorization gem that provides easy-to-read action and content-based permission management. It solves the problem of complex authorization setups by offering a straightforward syntax similar to Rails' Strong Parameters, allowing developers to define who can access what in their applications with minimal configuration.
Rails developers who need a clean, readable authorization solution without the overhead of more complex gems, particularly those already using Devise for authentication.
Developers choose Petergate for its simplicity and readability compared to alternatives like CanCan, offering just enough functionality for most authorization needs without unnecessary complexity while maintaining integration with Rails conventions.
Easy to use and read action and content based authorizations.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The access method mimics Rails before filters, making permission definitions intuitive and readable directly in controllers, as shown in the README with examples like access all: [:show, :index].
Petergate assumes Devise for authentication, providing out-of-the-box compatibility with minimal setup, requiring only standard methods like current_user and after_sign_in_path_for.
Supports custom roles with optional multiple roles per user, configured via a simple petergate method in the User model, allowing easy role assignment and queries like user.has_roles?.
Includes logged_in? helper for conditional content in views, enabling role-based UI changes without controller logic, as demonstrated in the ERB example for link visibility.
Features a :root_admin role that bypasses all checks, useful for administrative overrides in critical situations, though it requires caution as noted in the README.
Focuses solely on controller actions and lacks built-in support for resource-level or attribute-based permissions, which can be restrictive for applications with complex authorization logic beyond CRUD operations.
Tightly coupled with Devise; projects using other authentication systems require manual implementation of methods like current_user, adding setup complexity and potential integration issues.
Misses advanced features like permission scoping, policy objects, or declarative patterns, making it less suitable for evolving applications that might outgrow its basic role-based approach.
Petergate is an open-source alternative to the following products: