baldwindavid / authorization-examples

Simple authorization examples presented at the 12/11/2013 IndyRB meetup

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Authorization Examples

Here are a few examples of adding in simple authorization to your Rails app. This was presented at the 12/11/2013 IndyRB meetup. There were a few different examples provided. This was sort of live-coded so you will need to uncomment lines to see some of the examples in action.

Examples

  1. A require_admin before filter to protect a secret area.
  2. An authorize_actions! before filter with an overridable authorized? method
  3. A per-action authorize! method
  4. Moving authorization logic to the resource model (e.g. editable_by?)
  5. Calling authorization from the current_user (e.g. can_edit?)
  6. Changing the view based upon user privileges

About

Simple authorization examples presented at the 12/11/2013 IndyRB meetup


Languages

Language:Ruby 90.9%Language:CSS 5.2%Language:JavaScript 3.9%