# CanCanCommunity/cancancan

The authorization Gem for Ruby on Rails.

Repository: https://github.com/CanCanCommunity/cancancan
Canonical: https://ross.abutalabs.com/products/cancancan
Language: Ruby
License: MIT
License Family: permissive
Topics: authorization, cancancan, rails
Last push: 2026-08-09T13:29:52+00:00

## Health v2 (maintenance only)
Score: 66/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 96, release rhythm 8, longevity 100
- inputs: {"age_days": 4578, "days_push": 24, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 5686, forks 631 (observed 2026-08-28T04:09:27.915992+00:00)

## What it is
CanCanCan is an authorization library for Ruby and Ruby on Rails that restricts which resources a user can access. Permissions are defined in centralized Ability classes and checked via helpers in controllers and views, with automatic record loading and permission scoping for Rails controllers.

## Use cases
- restrict which records a user can read or edit in a Rails app
- define role-based permissions in one Ability file
- authorize controller actions automatically in Rails
- scope database queries to only permitted records
- check permissions in views with can? and cannot?
- handle guest vs logged-in vs admin access rules

## When to choose
- you are building a Ruby on Rails application and need centralized authorization logic
- you want permissions defined once and reused across controllers, views, and queries
- you need role-based or attribute-based access control without duplicating checks

## When to avoid
- you need authentication (login/password handling) rather than authorization
- you are not using Ruby or Rails
- you need fine-grained, dynamically administered permissions managed at runtime in a database-driven policy engine

## Facets
- artifact type: library
- maturity: stable
- function: authorization, middleware
- domain: web-development, backend, security
- platform: ruby
- tags: ruby-on-rails, gem, permissions, access-control, ability-rules, web-server

## Member repositories
- CanCanCommunity/cancancan (main) score 66

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:27.915992+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:54:13.680795+00:00, confidence not recorded.
  - readme: https://github.com/CanCanCommunity/cancancan (fetched 2026-08-28T04:09:27.915992+00:00, sha edc240be390f)
- Data as of 2026-08-30T08:39:29.467469+00:00.
