Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A comprehensive Rails authorization module presented at Kaigi on Rails 2025. Features practical examples of policy-based access control, role management, and permission handling patterns for modern Rails applications.

License

Notifications You must be signed in to change notification settings

naro143/rails-policy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

rails policy

A comprehensive Rails authorization module presented at Kaigi on Rails 2025. Features practical examples of policy-based access control, role management, and permission handling patterns for modern Rails applications.

https://kaigionrails.org/2025/talks/naro143/#day2

Overview

Authorization consists of target, action, role, and condition. By separating these components, we achieve simple and flexible permission management.

Usage

1. authorize - Single Record Authorization Check

project = Project.find(1)

readable_project = Policy.authorize(current_user, project, :read)

2. authorize_scope - Scope Authorization Check

projects = Project.all

readable_projects = Policy.authorize_scope(current_user, projects, :read)

3. permissions - Get Available Permissions List

Policy.permissions(current_user)

# => JSON
# {
#   "project": {
#     "read": true
#     "create": false,
#     "update": false,
#     "delete": false,
#   }
# }

About

A comprehensive Rails authorization module presented at Kaigi on Rails 2025. Features practical examples of policy-based access control, role management, and permission handling patterns for modern Rails applications.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages