Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Plugin for adding admin functionality to Clearance
Ruby
branch: master

Fixed conflict

latest commit 76e82fd451
Alvaro Pereyra Rabanal authored
Failed to load latest commit information.
generators/clearance_admin
lib
tasks
test
History.txt Fixed file structure
MIT-LICENSE
Manifest.txt
README.textile
Rakefile Fixed file structure
clearance_admin.gemspec Fixed file structure
init.rb Changed attr_accessor to attr_protected. The first one had no sense, …

README.textile

Clearance Admin

Added Admin functionality to Clearance. Based on the work of Jerry: http://github.com/jerry/clearance_admins/

Requirements

The Clearance engine

Installation

Add the plugin:


./script/plugin install git://github.com/srdperu/clearance-admin.git

Run the generate file to create migrations and add the include statements to your Controller and Model files:


./script/generate clearance_admin

Run your new migration files:


rake db:migrate

You are done!

How does it works?

It will add a new admin column to the User table and new module functionality for filtering users, adding barriers for non-users and non-admins.

If you don’t use the generator, be sure to add


  class ApplicationController < ActionController::Base
    include Clearance::Admin

and


  class User < ActiveRecord::Base
    include Clearance::Admin::User

You can then restrict access to your controllers like:


  class ProjectsController < ApplicationController

    before_filter :admin_only
    
  end

Or even restrict access to non-admin or non-logged users like:


  class ProjectsController < ApplicationController

    before_filter :user_only
    
  end

LICENSE:

(The MIT License)

Copyright © 2009 FIX

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
‘Software’), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.