Plugin for adding admin functionality to Clearance
Switch branches/tags
Nothing to show
Pull request Compare This branch is even with xenda:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
generators/clearance_admin
lib
tasks
test
History.txt
MIT-LICENSE
Manifest.txt
README.textile
Rakefile
clearance_admin.gemspec
init.rb

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.