user_impersonate2 0.9.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,18 +1,45 @@
1
1
  module UserImpersonate
2
2
  class Engine < Rails::Engine
3
- config.user_class = "User"
4
- config.user_finder = "find" # User.find
5
- config.user_id_column = "id" # Such that User.find(aUser.id) works
6
- config.user_name_column = "name" # Such that User.where("#{user_name_column} like ?", "%#{params[:search]}%") works
7
- config.user_is_staff_method = "staff?" # current_user.staff?
3
+ # Devise user model
4
+ config.user_class = 'User'
8
5
 
9
- config.redirect_on_impersonate = "/"
6
+ # User model lookup method
7
+ config.user_finder = 'find'
10
8
 
11
- # Do not use the default /impersonate URL since this
12
- # does not render with impersonation header
13
- config.redirect_on_revert = "/"
9
+ # User model primary key attribute
10
+ config.user_id_column = 'id'
14
11
 
15
- config.authenticate_user_method = "authenticate_user!" # protect impersonation controller
16
- config.sign_in_user_method = "sign_in" # sign_in(user)
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'
17
43
  end
18
44
  end
45
+
@@ -25,3 +25,21 @@
25
25
   (20.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120914184123')
26
26
   (25.0ms) INSERT INTO "schema_migrations" (version) VALUES ('20120914174453')
27
27
  ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
28
+  (40.3ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) DEFAULT '' NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL, "encrypted_password" varchar(255) DEFAULT '' NOT NULL, "reset_password_token" varchar(255), "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar(255), "last_sign_in_ip" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "staff" boolean DEFAULT 'f') 
29
+  (40.7ms) CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")
30
+  (21.7ms) CREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")
31
+  (22.0ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
32
+  (37.6ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
33
+  (0.3ms) SELECT version FROM "schema_migrations"
34
+  (36.6ms) INSERT INTO "schema_migrations" (version) VALUES ('20120914184123')
35
+  (25.3ms) INSERT INTO "schema_migrations" (version) VALUES ('20120914174453')
36
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
37
+  (18.6ms) CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255) DEFAULT '' NOT NULL, "email" varchar(255) DEFAULT '' NOT NULL, "encrypted_password" varchar(255) DEFAULT '' NOT NULL, "reset_password_token" varchar(255), "reset_password_sent_at" datetime, "remember_created_at" datetime, "sign_in_count" integer DEFAULT 0, "current_sign_in_at" datetime, "last_sign_in_at" datetime, "current_sign_in_ip" varchar(255), "last_sign_in_ip" varchar(255), "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL, "staff" boolean DEFAULT 'f') 
38
+  (33.8ms) CREATE UNIQUE INDEX "index_users_on_email" ON "users" ("email")
39
+  (32.6ms) CREATE UNIQUE INDEX "index_users_on_reset_password_token" ON "users" ("reset_password_token")
40
+  (20.8ms) CREATE TABLE "schema_migrations" ("version" varchar(255) NOT NULL)
41
+  (16.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
42
+  (0.1ms) SELECT version FROM "schema_migrations"
43
+  (15.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20120914184123')
44
+  (15.9ms) INSERT INTO "schema_migrations" (version) VALUES ('20120914174453')
45
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"