Skip to content

ucberkeley/rails_access

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SixArm.com » Rails »
Role Based Access Control (RBAC)

Introduction

Role Based Access Control (RBAC) works with users, assignments, roles, permissions, and operations.

To read a general introduction to RBAC: http:https://en.wikipedia.org/wiki/Role-based_access_control

User

A user is a tyipcally a person. Examples: Alice, Bob, Carol.

Role

A role is typically a job function. Examples: Administrator, Teacher, Student.

Operation

An operation is an application capability. Examples: "Read Note", "Play Song", "Send Mail",

Assignment

An assigment links a user and role. Example: Alice is assigned the administrator role.

Permission

A permission links a role and operation. Example: an Administrator has permission to read notes.

Diagram

A simple text diagram of the connections:

User <--> Assignment <--> Role <--> Permission <--> Operation

Rails generators

rails generate scaffold role name:string description:string
rails generate scaffold operation name:string description:string
rails generate scaffold assignment user:references role:references
rails generate scaffold permission role:references operation:references

Installing the engine

Add the gem to the parent application's Gemfile file:

gem 'access', :path => "vendor/engines/access"

Mount the engine in the parent application’s config/routes.rb file:

mount Access::Engine, :at => "access"

To copy migrations from the engine to the parent application:

rake access:install:migrations

Run the migrations as usual:

rake db:migrate

Run the parent app as usual:

rails server

To try the engine:

http:https://localhost:3000/access

About

Rails engine for Role Based Access Control

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published