Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dancroak-clearance-admin

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dancroak-clearance-admin

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

h1. Clearance

Admin feature for Clearance authentication

"We have clearance, Clarence.":http://www.youtube.com/v/mNRXJEE3Nz8

h2. Features

h2. Gem installation (Rails 2.1+)

Specify the gem dependency in your config/environment.rb file:

Rails::Initializer.run do |config|
  # ...
  config.gem 'dancroak-clearance-admin', :lib => 'clearance-admin', :source => "http://gems.github.com"
end

Then:

rake gems:install
rake gems:unpack

h2. Tests

The tests use "Shoulda":http://thoughtbot.com/projects/shoulda and "Factory Girl":http://thoughtbot.com/projects/factory_girl. Update your User Factory:

Factory.define :user do |user|
  user.email { Factory.next :email }
  user.password 'sekrit'
  user.password_confirmation 'sekrit'
  user.admin false
end

In test/unit/user_test.rb:

class UserTest < Test::Unit::TestCase
  include Clearance::UserTest
  include Clearance::Admin::UserTest
end

h2. Schema

Write a migration:

add_column :users, :admin, :boolean

h2. User Model

In app/models/user.rb:

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

h2. Controllers

In app/controllers/admin/users_controller.rb:

class Admin::UsersController < ActionController::Base
  include Clearance::Admin::UsersController
end

h2. Routes

map.namespace :admin do |admin|
    admin.resources :users
  end

h2. Views

In app/views/admin/users/new.html.erb

<% form_for :session, :url => session_path do |f| %>

<%= f.label :email %> <%= f.text_field :email %>
<%= f.label :password %> <%= f.password_field :password %>
<%= f.check_box :remember_me %> <%= f.label :remember_me %>
<%= f.submit 'Login', :disable_with => 'Please wait...' %>
<% end %>

h2. Authors

  • Dan Croak

FAQs

Package last updated on 11 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc