Giter Club home page Giter Club logo

right_on's Introduction

Right On

Build Status Build Status Build Status

DESCRIPTION

Gives rails applications a way to manage rights/roles

If you have a class User, then you can use it like so:

class User < ActiveRecord::Base
  include RightOn::RoleModel
end

This will create a many-to-many relationship with roles

Roles are sets of rights. Generally people will have multiple roles e.g. A senior bank teller might have the following roles:

  • Senior Bank Teller
  • Bank Teller
  • Bank Employee

The Role class also has a many-to-many relationship with rights

So a bank employee might have access to the building during regular hours e.g. has a right 'transactions/add' giving him access to the add method of the transactions controller

Wheras the senior bank teller might be the only one with the 'tellers/create' Thus he is the only one who can create new tellers.

There are a few types of rights:

  • Rights giving access to an entire controller (tellers)
  • Rights giving access to a single action within a controller (e.g. tellers/show)
  • Rights giving access to multiple actions within a controller (e.g. tellers/read_only or tellers/read_write)
  • Rights giving access to particular objects, e.g. a right gives you access to contact clients with a type "High Value Clients"
  • Rights giving custom access. To have affect you need to use the has_right? Helper in you views

RightOn comes with controller methods to verify if the user has rights. Simply add the following in your app to controllers you want to enforce rights:

include RightOn::ActionControllerExtensions

before_filter :verify_rights

This will enforce that you have a right matching the controllers right You must have a method "current_user" which is the user model that you've made as the RoleModel

INSTALLATION

Add to your Gemfile: gem 'right_on'

right_on's People

Contributors

mnoack avatar adz avatar alxberardi avatar

Watchers

Michael Smirnoff avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.