Pundit
Minimal authorization through OO design and pure Ruby classes (by varvet)
CanCanCan
The authorization Gem for Ruby on Rails. (by CanCanCommunity)
Our great sponsors
Pundit | CanCanCan | |
---|---|---|
20 | 14 | |
7,850 | 5,275 | |
0.5% | 0.5% | |
3.4 | 7.1 | |
19 days ago | 5 days ago | |
Ruby | Ruby | |
MIT License | MIT License |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Pundit
Posts with mentions or reviews of Pundit.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-11-30.
-
Permissions (access control) in web apps
https://github.com/varvet/pundit Popular open-source Ruby library focused around the notion of policies, giving you the freedom to implement your own approach based on that.
-
YAGNI exceptions
PS If you do mobile / web work (or something else with "detached" UI), I find that declarative access control rules are far superior to imperative ones, because they can be serialized and shipped over the wire. For example, backend running cancancan can be easily send the same rules to casl on the frontend, while if you used something like pundit to secure your backend, you either end up re-implementing it in the frontend, or sending ton of "canEdit" flags with every record.
-
Best practice for displaying info to different user roles?
You can use a combination of an authorization gem (https://github.com/varvet/pundit) and decorators (https://www.rubyguides.com/2018/04/decorator-pattern-in-ruby/) if you want to extend functionality based on their roles.
-
Concerns about authorization when going in production
Use Action Policy or Pundit, and write tests for your policies. Authz is worth testing with near complete coverage.
-
Complete Guide To Managing User Permissions In Rails Apps
Pundit: Pundit is a gem that uses simple Ruby objects, and it is probably the simplest policy gem we will cover. Is simple to use, has minimal authorization, and is similar to using pure Ruby. With 7.3k stars on GitHub, it is currently the most popular policy gem.
-
Authorization and Policy Scopes for Phoenix Apps
If you come from the Rails world, you might be familiar with some gems that provide APIs to handle this, the most popular ones being cancancan and pundit.
-
Conditional Rendering With Turbo Stream Broadcasts
A very common pattern in Rails development is for a view to contain checks for things like current_user.can?(:take_some_action). These types of checks are common, especially in B2B applications that implement role-based permissions powered by a solution like Pundit.
-
Rails application boilerplate for fast MVP development
authorization with pundit
-
Frontend based access control?
Right now, all access control is done using Pundit and since most things are server side rendered, not only are the API endpoints authorized by Pundit policies, but some UI components conditionally render based on these policies as well.
-
Access control gem for your Rails application (the 2nd)
You may ask what's makes Active Entry better or different from other gems like Pundit, Action Policy (especially), or CanCanCan.
CanCanCan
Posts with mentions or reviews of CanCanCan.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2023-01-04.
- Top 5 Ruby on Rails Gems
-
Permissions (access control) in web apps
https://github.com/CanCanCommunity/cancancan (Ruby on Rails ABAC) Same like casl.js, but for Ruby on Rails! Casl.js was actually inspired and modeled by cancancan.
-
Web-app security risks demonstrated
In production code you would most likely use a library for access control, such as CanCanCan
-
YAGNI exceptions
PS If you do mobile / web work (or something else with "detached" UI), I find that declarative access control rules are far superior to imperative ones, because they can be serialized and shipped over the wire. For example, backend running cancancan can be easily send the same rules to casl on the frontend, while if you used something like pundit to secure your backend, you either end up re-implementing it in the frontend, or sending ton of "canEdit" flags with every record.
-
Best practice for displaying info to different user roles?
You can use a gem like cancancan (https://github.com/CanCanCommunity/cancancan )to manage authorization, and its helpers to show stuff based on what a user can do
-
What are the gems that every Ruby dev should know how to use?
It fails deadly -- forgetting to pass an instance grants unintended access, and this problem is so bad they have a document explaining how to avoid it. If you use a permission in an unintended way, it should not grant access.
-
Complete Guide To Managing User Permissions In Rails Apps
CanCanCan: CanCanCan is another authorization library for Ruby and Ruby on Rails. It is an alternative to CanCan and is currently being maintained. With 4.9k stars on GitHub, it is the least popular, but it works pretty well and is well maintained.
-
Mugshot Bot Acquisition: our side of the story
I have worked on Ruby On Rails for 10 years now, and I also became the maintainer of one of the most historical gems, CanCanCan. Ruby On Rails was my bet ten years ago, when I quit my previous job, to switch from Java to Ruby, and to move from Italy to Switzerland at the same time.
-
Authorization and Policy Scopes for Phoenix Apps
If you come from the Rails world, you might be familiar with some gems that provide APIs to handle this, the most popular ones being cancancan and pundit.
-
Motor Admin - a modern Admin UI and Business Intelligence Rails engine
I am using cancancan I will check it out when it's done thx!
What are some alternatives?
When comparing Pundit and CanCanCan you can also consider the following projects:
rolify - Role management library with resource scoping
Devise - Flexible authentication solution for Rails with Warden.
Action Policy - Authorization framework for Ruby/Rails applications
Authority
Declarative Authorization - An unmaintained authorization plugin for Rails. Please fork to support current versions of Rails
Consul - Scope-based authorization for Ruby on Rails.
AccessGranted - Multi-role and whitelist based authorization gem for Rails (and not only Rails!)
oso - Oso is a batteries-included framework for building authorization in your application.