user_impersonate2 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -10
  3. data/app/controllers/user_impersonate/impersonate_controller.rb +19 -8
  4. data/lib/user_impersonate/version.rb +1 -1
  5. data/test/test_utils.rb +3 -10
  6. metadata +66 -158
  7. data/test/dummy-rails3/README.rdoc +0 -261
  8. data/test/dummy-rails3/Rakefile +0 -7
  9. data/test/dummy-rails3/app/assets/javascripts/application.js +0 -15
  10. data/test/dummy-rails3/app/assets/javascripts/home.js +0 -2
  11. data/test/dummy-rails3/app/assets/stylesheets/application.css +0 -16
  12. data/test/dummy-rails3/app/assets/stylesheets/home.css +0 -7
  13. data/test/dummy-rails3/app/controllers/application_controller.rb +0 -3
  14. data/test/dummy-rails3/app/controllers/home_controller.rb +0 -4
  15. data/test/dummy-rails3/app/helpers/application_helper.rb +0 -2
  16. data/test/dummy-rails3/app/helpers/home_helper.rb +0 -2
  17. data/test/dummy-rails3/app/models/user.rb +0 -17
  18. data/test/dummy-rails3/app/views/home/index.html.erb +0 -11
  19. data/test/dummy-rails3/app/views/layouts/application.html.erb +0 -22
  20. data/test/dummy-rails3/app/views/user_impersonate/_header.html.erb +0 -65
  21. data/test/dummy-rails3/config.ru +0 -4
  22. data/test/dummy-rails3/config/application.rb +0 -60
  23. data/test/dummy-rails3/config/boot.rb +0 -10
  24. data/test/dummy-rails3/config/database.yml +0 -25
  25. data/test/dummy-rails3/config/environment.rb +0 -5
  26. data/test/dummy-rails3/config/environments/development.rb +0 -40
  27. data/test/dummy-rails3/config/environments/production.rb +0 -67
  28. data/test/dummy-rails3/config/environments/test.rb +0 -37
  29. data/test/dummy-rails3/config/initializers/backtrace_silencers.rb +0 -7
  30. data/test/dummy-rails3/config/initializers/devise.rb +0 -232
  31. data/test/dummy-rails3/config/initializers/mime_types.rb +0 -5
  32. data/test/dummy-rails3/config/initializers/secret_token.rb +0 -7
  33. data/test/dummy-rails3/config/initializers/session_store.rb +0 -8
  34. data/test/dummy-rails3/config/initializers/user_impersonate.rb +0 -45
  35. data/test/dummy-rails3/config/initializers/wrap_parameters.rb +0 -14
  36. data/test/dummy-rails3/config/locales/devise.en.yml +0 -58
  37. data/test/dummy-rails3/config/locales/en.yml +0 -5
  38. data/test/dummy-rails3/config/routes.rb +0 -8
  39. data/test/dummy-rails3/db/migrate/20120914174453_devise_create_users.rb +0 -48
  40. data/test/dummy-rails3/db/migrate/20120914184123_add_staff_flag_to_users.rb +0 -5
  41. data/test/dummy-rails3/db/schema.rb +0 -36
  42. data/test/dummy-rails3/lib/tasks/cucumber.rake +0 -65
  43. data/test/dummy-rails3/public/404.html +0 -26
  44. data/test/dummy-rails3/public/422.html +0 -26
  45. data/test/dummy-rails3/public/500.html +0 -25
  46. data/test/dummy-rails3/public/favicon.ico +0 -0
  47. data/test/dummy-rails3/script/rails +0 -6
  48. data/test/dummy-rails3/test/fixtures/users.yml +0 -14
  49. data/test/dummy-rails3/test/unit/helpers/home_helper_test.rb +0 -4
  50. data/test/dummy-rails3/test/unit/user_test.rb +0 -7
  51. data/test/dummy-rails4/db/test.sqlite3 +0 -0
  52. data/test/dummy-rails4/log/test.log +0 -92
@@ -1,5 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
6
- # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_token = '84197a915f6cc6ca4e83de35fbd2b36d7c0ffd4b5d01bf90fd9262f4a8e270c1b631c03395f2aba0dbecf6698da2d01ec5337578e266f8438e240d6db6ce65c1'
@@ -1,8 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
-
5
- # Use the database for sessions instead of the cookie-based default,
6
- # which shouldn't be used to store highly confidential information
7
- # (create the session table with "rails generate session_migration")
8
- # Dummy::Application.config.session_store :active_record_store
@@ -1,45 +0,0 @@
1
- module UserImpersonate
2
- class Engine < Rails::Engine
3
- # Devise user model
4
- config.user_class = 'User'
5
-
6
- # User model lookup method
7
- config.user_finder = 'find'
8
-
9
- # User model primary key attribute
10
- config.user_id_column = 'id'
11
-
12
- # User model name attribute used for search
13
- # Usage: User.where('#{user_name_column} like ?', '%#{params[:search]}%')
14
- config.user_name_column = 'name'
15
-
16
- # User model staff attribute
17
- config.user_is_staff_method = 'staff?'
18
-
19
- # Redirect to this path when entering impersonate mode
20
- config.redirect_on_impersonate = '/'
21
-
22
- # Redirect to this path when leaving impersonate mode
23
- # In test mode, we use '/' since this includes an impersonation header
24
- config.redirect_on_revert = '/'
25
-
26
- # Devise filter method used to protect impersonation controller
27
- # For Active Admin "AdminUser" model, change to 'authenticate_admin_user!'
28
- config.authenticate_user_method = 'authenticate_user!'
29
-
30
- # Devise method used to sign user in
31
- config.sign_in_user_method = 'sign_in'
32
-
33
- # Devise staff user class
34
- # For Active Admin "AdminUser" model, change to 'AdminUser'
35
- config.staff_class = 'User'
36
-
37
- # Staff user model lookup method
38
- config.staff_finder = 'find'
39
-
40
- # Devise method storing current user
41
- # For Active Admin "AdminUser" model, change to 'current_admin_user'
42
- config.current_staff = 'current_user'
43
- end
44
- end
45
-
@@ -1,14 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
- #
3
- # This file contains settings for ActionController::ParamsWrapper which
4
- # is enabled by default.
5
-
6
- # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
- ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json]
9
- end
10
-
11
- # Disable root element in JSON by default.
12
- ActiveSupport.on_load(:active_record) do
13
- self.include_root_in_json = false
14
- end
@@ -1,58 +0,0 @@
1
- # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
-
3
- en:
4
- errors:
5
- messages:
6
- expired: "has expired, please request a new one"
7
- not_found: "not found"
8
- already_confirmed: "was already confirmed, please try signing in"
9
- not_locked: "was not locked"
10
- not_saved:
11
- one: "1 error prohibited this %{resource} from being saved:"
12
- other: "%{count} errors prohibited this %{resource} from being saved:"
13
-
14
- devise:
15
- failure:
16
- already_authenticated: 'You are already signed in.'
17
- unauthenticated: 'You need to sign in or sign up before continuing.'
18
- unconfirmed: 'You have to confirm your account before continuing.'
19
- locked: 'Your account is locked.'
20
- invalid: 'Invalid email or password.'
21
- invalid_token: 'Invalid authentication token.'
22
- timeout: 'Your session expired, please sign in again to continue.'
23
- inactive: 'Your account was not activated yet.'
24
- sessions:
25
- signed_in: 'Signed in successfully.'
26
- signed_out: 'Signed out successfully.'
27
- passwords:
28
- send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
29
- updated: 'Your password was changed successfully. You are now signed in.'
30
- updated_not_active: 'Your password was changed successfully.'
31
- send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
32
- no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
33
- confirmations:
34
- send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
35
- send_paranoid_instructions: 'If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
36
- confirmed: 'Your account was successfully confirmed. You are now signed in.'
37
- registrations:
38
- signed_up: 'Welcome! You have signed up successfully.'
39
- signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
40
- signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
41
- signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
42
- updated: 'You updated your account successfully.'
43
- update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
44
- destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
45
- unlocks:
46
- send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
47
- unlocked: 'Your account has been unlocked successfully. Please sign in to continue.'
48
- send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
49
- omniauth_callbacks:
50
- success: 'Successfully authenticated from %{kind} account.'
51
- failure: 'Could not authenticate you from %{kind} because "%{reason}".'
52
- mailer:
53
- confirmation_instructions:
54
- subject: 'Confirmation instructions'
55
- reset_password_instructions:
56
- subject: 'Reset password instructions'
57
- unlock_instructions:
58
- subject: 'Unlock Instructions'
@@ -1,5 +0,0 @@
1
- # Sample localization file for English. Add more files in this directory for other locales.
2
- # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
-
4
- en:
5
- hello: "Hello world"
@@ -1,8 +0,0 @@
1
- Rails.application.routes.draw do
2
-
3
- devise_for :users
4
-
5
- root :to => "home#index"
6
-
7
- mount UserImpersonate::Engine => "/impersonate", as: "impersonate_engine"
8
- end
@@ -1,48 +0,0 @@
1
- class DeviseCreateUsers < ActiveRecord::Migration
2
- def change
3
- create_table(:users) do |t|
4
- t.string :name, :null => false, :default => ""
5
-
6
- ## Database authenticatable
7
- t.string :email, :null => false, :default => ""
8
- t.string :encrypted_password, :null => false, :default => ""
9
-
10
- ## Recoverable
11
- t.string :reset_password_token
12
- t.datetime :reset_password_sent_at
13
-
14
- ## Rememberable
15
- t.datetime :remember_created_at
16
-
17
- ## Trackable
18
- t.integer :sign_in_count, :default => 0
19
- t.datetime :current_sign_in_at
20
- t.datetime :last_sign_in_at
21
- t.string :current_sign_in_ip
22
- t.string :last_sign_in_ip
23
-
24
- ## Confirmable
25
- # t.string :confirmation_token
26
- # t.datetime :confirmed_at
27
- # t.datetime :confirmation_sent_at
28
- # t.string :unconfirmed_email # Only if using reconfirmable
29
-
30
- ## Lockable
31
- # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
32
- # t.string :unlock_token # Only if unlock strategy is :email or :both
33
- # t.datetime :locked_at
34
-
35
- ## Token authenticatable
36
- # t.string :authentication_token
37
-
38
-
39
- t.timestamps
40
- end
41
-
42
- add_index :users, :email, :unique => true
43
- add_index :users, :reset_password_token, :unique => true
44
- # add_index :users, :confirmation_token, :unique => true
45
- # add_index :users, :unlock_token, :unique => true
46
- # add_index :users, :authentication_token, :unique => true
47
- end
48
- end
@@ -1,5 +0,0 @@
1
- class AddStaffFlagToUsers < ActiveRecord::Migration
2
- def change
3
- add_column :users, :staff, :boolean, default: false
4
- end
5
- end
@@ -1,36 +0,0 @@
1
- # encoding: UTF-8
2
- # This file is auto-generated from the current state of the database. Instead
3
- # of editing this file, please use the migrations feature of Active Record to
4
- # incrementally modify your database, and then regenerate this schema definition.
5
- #
6
- # Note that this schema.rb definition is the authoritative source for your
7
- # database schema. If you need to create the application database on another
8
- # system, you should be using db:schema:load, not running all the migrations
9
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
- # you'll amass, the slower it'll run and the greater likelihood for issues).
11
- #
12
- # It's strongly recommended to check this file into your version control system.
13
-
14
- ActiveRecord::Schema.define(:version => 20120914184123) do
15
-
16
- create_table "users", :force => true do |t|
17
- t.string "name", :default => "", :null => false
18
- t.string "email", :default => "", :null => false
19
- t.string "encrypted_password", :default => "", :null => false
20
- t.string "reset_password_token"
21
- t.datetime "reset_password_sent_at"
22
- t.datetime "remember_created_at"
23
- t.integer "sign_in_count", :default => 0
24
- t.datetime "current_sign_in_at"
25
- t.datetime "last_sign_in_at"
26
- t.string "current_sign_in_ip"
27
- t.string "last_sign_in_ip"
28
- t.datetime "created_at", :null => false
29
- t.datetime "updated_at", :null => false
30
- t.boolean "staff", :default => false
31
- end
32
-
33
- add_index "users", ["email"], :name => "index_users_on_email", :unique => true
34
- add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
35
-
36
- end
@@ -1,65 +0,0 @@
1
- # IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2
- # It is recommended to regenerate this file in the future when you upgrade to a
3
- # newer version of cucumber-rails. Consider adding your own code to a new file
4
- # instead of editing this one. Cucumber will automatically load all features/**/*.rb
5
- # files.
6
-
7
-
8
- unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
9
-
10
- vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
11
- $LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
12
-
13
- begin
14
- require 'cucumber/rake/task'
15
-
16
- namespace :cucumber do
17
- Cucumber::Rake::Task.new({:ok => 'db:test:prepare'}, 'Run features that should pass') do |t|
18
- t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
19
- t.fork = true # You may get faster startup if you set this to false
20
- t.profile = 'default'
21
- end
22
-
23
- Cucumber::Rake::Task.new({:wip => 'db:test:prepare'}, 'Run features that are being worked on') do |t|
24
- t.binary = vendored_cucumber_bin
25
- t.fork = true # You may get faster startup if you set this to false
26
- t.profile = 'wip'
27
- end
28
-
29
- Cucumber::Rake::Task.new({:rerun => 'db:test:prepare'}, 'Record failing features and run only them if any exist') do |t|
30
- t.binary = vendored_cucumber_bin
31
- t.fork = true # You may get faster startup if you set this to false
32
- t.profile = 'rerun'
33
- end
34
-
35
- desc 'Run all features'
36
- task :all => [:ok, :wip]
37
-
38
- task :statsetup do
39
- require 'rails/code_statistics'
40
- ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
41
- ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
42
- end
43
- end
44
- desc 'Alias for cucumber:ok'
45
- task :cucumber => 'cucumber:ok'
46
-
47
- task :default => :cucumber
48
-
49
- task :features => :cucumber do
50
- STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
51
- end
52
-
53
- # In case we don't have ActiveRecord, append a no-op task that we can depend upon.
54
- task 'db:test:prepare' do
55
- end
56
-
57
- task :stats => 'cucumber:statsetup'
58
- rescue LoadError
59
- desc 'cucumber rake task not available (cucumber not installed)'
60
- task :cucumber do
61
- abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
62
- end
63
- end
64
-
65
- end
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The page you were looking for doesn't exist (404)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/404.html -->
21
- <div class="dialog">
22
- <h1>The page you were looking for doesn't exist.</h1>
23
- <p>You may have mistyped the address or the page may have moved.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,26 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>The change you wanted was rejected (422)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/422.html -->
21
- <div class="dialog">
22
- <h1>The change you wanted was rejected.</h1>
23
- <p>Maybe you tried to change something you didn't have access to.</p>
24
- </div>
25
- </body>
26
- </html>
@@ -1,25 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>We're sorry, but something went wrong (500)</title>
5
- <style type="text/css">
6
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
- div.dialog {
8
- width: 25em;
9
- padding: 0 4em;
10
- margin: 4em auto 0 auto;
11
- border: 1px solid #ccc;
12
- border-right-color: #999;
13
- border-bottom-color: #999;
14
- }
15
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
- </style>
17
- </head>
18
-
19
- <body>
20
- <!-- This file lives in public/500.html -->
21
- <div class="dialog">
22
- <h1>We're sorry, but something went wrong.</h1>
23
- </div>
24
- </body>
25
- </html>
File without changes
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'
@@ -1,14 +0,0 @@
1
- # passwords are abc123
2
-
3
- staff:
4
- id: 1
5
- name: Dr Nic Williams
6
- email: drnicwilliams@gmail.com
7
- staff: true
8
- encrypted_password: $2a$10$HV6E2Hgk2z6hqow76r6IL.5gcnqCSqJYuOuOT.nbqdPffBLvwglzK
9
-
10
- normal_user:
11
- id: 2
12
- name: Normal User
13
- email: normaluser@gmail.com
14
- encrypted_password: $2a$10$HV6E2Hgk2z6hqow76r6IL.5gcnqCSqJYuOuOT.nbqdPffBLvwglzK
@@ -1,4 +0,0 @@
1
- require 'test_helper'
2
-
3
- class HomeHelperTest < ActionView::TestCase
4
- end
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class UserTest < ActiveSupport::TestCase
4
- # test "the truth" do
5
- # assert true
6
- # end
7
- end
File without changes