- Doc: http:https://sixarm.com/sixarm_rails_rbac/doc
- Gem: http:https://rubygems.org/gems/sixarm_rails_rbac
- Repo: http:https://github.com/sixarm/sixarm_rails_rbac
- Email: Joel Parker Henderson, [email protected]
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
A user is a tyipcally a person. Examples: Alice, Bob, Carol.
A role is typically a job function. Examples: Administrator, Teacher, Student.
An operation is an application capability. Examples: "Read Note", "Play Song", "Send Mail",
An assigment links a user and role. Example: Alice is assigned the administrator role.
A permission links a role and operation. Example: an Administrator has permission to read notes.
A simple text diagram of the connections:
User <--> Assignment <--> Role <--> Permission <--> Operation
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
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