sn_rails_admin_impersonate 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 11217522e898342abed3cc16662095432d0b1d45b63bfe316c157ee6e35489cb
4
+ data.tar.gz: 34a401516afa03dd0c20948ad0874b925b382e9c3babbbb67aede90b302a3fad
5
+ SHA512:
6
+ metadata.gz: feb97e15933d134e0d66b78b9579c99867a926a396dd427bbb08ab744cb2e109baa2c5a4efaebd22358cad70a65d993e210a7be3a4ee43da68ec8a820fdf37c0
7
+ data.tar.gz: b6cc30c59dde175d5c5fd3c3117d99680003ca53fa0df57f29f744507fef096537c577aa229e0b3a8f61271c15a59c147890e93551aaadaf78faa09b64b0f0ea
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
@@ -0,0 +1,6 @@
1
+ # 0.0.5
2
+ - repackage gem with bundler
3
+ - disable impersonation for Admin model
4
+
5
+ # 0.0.4
6
+ - relax rails dependency to support rails 4
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rails_admin_impersonate.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Vitaly Kushner
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,63 @@
1
+ # RailsAdminImpersonate
2
+
3
+ Add an ability to [rails_admin](https://github.com/sferik/rails_admin) to impersonate as any user or actually any member
4
+ that is devise authenticatable.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'rails_admin_impersonate'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ ## Usage
17
+
18
+ Add to your `config/initializers/rails_admin.rb` an action `impersonate` to actions:
19
+
20
+ config.actions do
21
+ # root actions
22
+ dashboard # mandatory
23
+ # collection actions
24
+ index # mandatory
25
+ new
26
+ export
27
+ history_index
28
+ bulk_delete
29
+ # member actions
30
+ show
31
+ edit
32
+ delete
33
+ history_show
34
+ show_in_app
35
+ impersonate
36
+ end
37
+
38
+ Now restart the application and visit User table in the admin.
39
+
40
+ You should see home icon and Impersonate link for every model that uses Devise.
41
+
42
+ Note: by default impersonation is disabled for model `Admin`. If you want to
43
+ disable it for some other model you can modify the above code like this:
44
+
45
+ config.actions do
46
+ ...
47
+ impersonate do
48
+ authorized do
49
+ 'ModelName' != bindings[:abstract_model].model_name
50
+ end
51
+ end
52
+
53
+ ## Contributing
54
+
55
+ 1. Fork it
56
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
57
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
58
+ 4. Push to the branch (`git push origin my-new-feature`)
59
+ 5. Create new Pull Request
60
+
61
+ ## Copyright
62
+
63
+ © 2013 [Boris Nadion](mailto:boris@astrails.com)
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,6 @@
1
+ en:
2
+ admin:
3
+ actions:
4
+ impersonate:
5
+ menu: "Impersonate"
6
+
@@ -0,0 +1,41 @@
1
+ require "rails_admin_impersonate/version"
2
+
3
+ module RailsAdmin
4
+ module Config
5
+ module Actions
6
+ class Impersonate < RailsAdmin::Config::Actions::Base
7
+ register_instance_option :visible? do
8
+ ('Admin' != bindings[:abstract_model].model_name) &&
9
+ authorized? && bindings[:object].respond_to?(:devise_modules)
10
+ end
11
+
12
+ register_instance_option :member? do
13
+ true
14
+ end
15
+
16
+ register_instance_option :pjax? do
17
+ false
18
+ end
19
+
20
+ register_instance_option :http_methods do
21
+ [:get]
22
+ end
23
+
24
+ register_instance_option :link_icon do
25
+ 'icon-home'
26
+ end
27
+
28
+ register_instance_option :controller do
29
+ Proc.new do
30
+ sign_in @object
31
+ redirect_to "/"
32
+ end
33
+ end
34
+
35
+ RailsAdmin::Config::Actions.register(self)
36
+ end
37
+ end
38
+ end
39
+ end
40
+
41
+ I18n.load_path += Dir.glob(File.expand_path("../../config/locales/*.{rb,yml}", __FILE__))
@@ -0,0 +1,3 @@
1
+ module RailsAdminImpersonate
2
+ VERSION = "0.0.6"
3
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rails_admin_impersonate/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sn_rails_admin_impersonate"
8
+ spec.version = RailsAdminImpersonate::VERSION
9
+ spec.authors = ["Boris Nadion"]
10
+ spec.email = ["boris@astrails.com"]
11
+ spec.summary = "Impersonate as a Devise user for rails_admin"
12
+ spec.description = "Impersonate as a Devise user for rails_admin"
13
+ spec.homepage = "https://github.com/astrails/rails_admin_impersonate"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "rails"
22
+ spec.add_dependency "rails_admin"
23
+ spec.add_development_dependency "bundler"
24
+ spec.add_development_dependency "rake"
25
+ end
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sn_rails_admin_impersonate
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.6
5
+ platform: ruby
6
+ authors:
7
+ - Boris Nadion
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-09-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails_admin
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Impersonate as a Devise user for rails_admin
70
+ email:
71
+ - boris@astrails.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Changelog
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - config/locales/rails_admin_impersonate.yml
83
+ - lib/rails_admin_impersonate.rb
84
+ - lib/rails_admin_impersonate/version.rb
85
+ - rails_admin_impersonate.gemspec
86
+ homepage: https://github.com/astrails/rails_admin_impersonate
87
+ licenses:
88
+ - MIT
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 2.7.7
107
+ signing_key:
108
+ specification_version: 4
109
+ summary: Impersonate as a Devise user for rails_admin
110
+ test_files: []