Add auth around admin

[Delivers #16802507]
This commit is contained in:
Erik Michaels-Ober 2011-10-10 15:07:32 -07:00
parent 6462a62060
commit 1579f3fb83
3 changed files with 10 additions and 3 deletions

View File

@ -0,0 +1,5 @@
RailsAdmin.config do |config|
config.authenticate_with do
redirect_to '/' unless signed_in? && current_user.admin?
end
end

View File

@ -7,6 +7,7 @@ class DeviseCreateUsers < ActiveRecord::Migration
t.string :email, :null => false
t.string :voice_number
t.string :sms_number
t.boolean :admin, :default => false
t.database_authenticatable :null => false
t.recoverable
t.rememberable

View File

@ -55,12 +55,13 @@ ActiveRecord::Schema.define(:version => 4) do
create_table "users", :force => true do |t|
t.datetime "created_at"
t.datetime "updated_at"
t.string "name", :null => false
t.string "name", :null => false
t.string "organization"
t.string "email", :default => "", :null => false
t.string "email", :default => "", :null => false
t.string "voice_number"
t.string "sms_number"
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.boolean "admin", :default => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "reset_password_token"
t.string "remember_token"
t.datetime "remember_created_at"