rails_admin_impersonate 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
@@ -1,4 +1,6 @@
1
- Copyright 2013 YOURNAME
1
+ Copyright (c) 2013 Vitaly Kushner
2
+
3
+ MIT License
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining
4
6
  a copy of this software and associated documentation files (the
@@ -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)
data/Rakefile CHANGED
@@ -1,27 +1 @@
1
- #!/usr/bin/env rake
2
- begin
3
- require 'bundler/setup'
4
- rescue LoadError
5
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
- end
7
- begin
8
- require 'rdoc/task'
9
- rescue LoadError
10
- require 'rdoc/rdoc'
11
- require 'rake/rdoctask'
12
- RDoc::Task = Rake::RDocTask
13
- end
14
-
15
- RDoc::Task.new(:rdoc) do |rdoc|
16
- rdoc.rdoc_dir = 'rdoc'
17
- rdoc.title = 'RailsAdminImpersonate'
18
- rdoc.options << '--line-numbers'
19
- rdoc.rdoc_files.include('README.markdown')
20
- rdoc.rdoc_files.include('lib/**/*.rb')
21
- end
22
-
23
-
24
-
25
-
26
- Bundler::GemHelper.install_tasks
27
-
1
+ require "bundler/gem_tasks"
@@ -1,14 +1,12 @@
1
- require "rails_admin_impersonate/engine"
2
-
3
- module RailsAdminImpersonate
4
- end
1
+ require "rails_admin_impersonate/version"
5
2
 
6
3
  module RailsAdmin
7
4
  module Config
8
5
  module Actions
9
6
  class Impersonate < RailsAdmin::Config::Actions::Base
10
7
  register_instance_option :visible? do
11
- authorized? && bindings[:object].respond_to?(:devise_modules)
8
+ ('Admin' != bindings[:abstract_model].model_name) &&
9
+ authorized? && bindings[:object].respond_to?(:devise_modules)
12
10
  end
13
11
 
14
12
  register_instance_option :member? do
@@ -39,3 +37,5 @@ module RailsAdmin
39
37
  end
40
38
  end
41
39
  end
40
+
41
+ I18n.load_path += Dir.glob(File.expand_path("../../config/locales/*.{rb,yml}", __FILE__))
@@ -1,3 +1,3 @@
1
1
  module RailsAdminImpersonate
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
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 = "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", ">= 3.2.13"
22
+ spec.add_dependency "rails_admin"
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ end
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: rails_admin_impersonate
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.4
5
+ version: 0.0.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - Boris Nadion
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-03 00:00:00.000000000 Z
12
+ date: 2013-12-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -43,22 +43,55 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- description:
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.3'
54
+ requirement: !ruby/object:Gem::Requirement
55
+ none: false
56
+ requirements:
57
+ - - ~>
58
+ - !ruby/object:Gem::Version
59
+ version: '1.3'
60
+ type: :development
61
+ prerelease: false
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ requirement: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ description: Impersonate as a Devise user for rails_admin
47
79
  email:
48
80
  - boris@astrails.com
49
81
  executables: []
50
82
  extensions: []
51
83
  extra_rdoc_files: []
52
84
  files:
85
+ - .gitignore
86
+ - Changelog
87
+ - Gemfile
88
+ - LICENSE.txt
89
+ - README.md
90
+ - Rakefile
53
91
  - config/locales/rails_admin_impersonate.yml
54
- - config/routes.rb
55
- - lib/rails_admin_impersonate/engine.rb
56
- - lib/rails_admin_impersonate/version.rb
57
92
  - lib/rails_admin_impersonate.rb
58
- - lib/tasks/rails_admin_impersonate_tasks.rake
59
- - MIT-LICENSE
60
- - Rakefile
61
- - README.markdown
93
+ - lib/rails_admin_impersonate/version.rb
94
+ - rails_admin_impersonate.gemspec
62
95
  homepage: https://github.com/astrails/rails_admin_impersonate
63
96
  licenses:
64
97
  - MIT
@@ -85,3 +118,4 @@ signing_key:
85
118
  specification_version: 3
86
119
  summary: Impersonate as a Devise user for rails_admin
87
120
  test_files: []
121
+ has_rdoc:
@@ -1,17 +0,0 @@
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: just add to your Gemfile.
7
-
8
- gem 'rails_admin'
9
- gem 'rails_admin_impersonate'
10
-
11
- You should see home icon and Impersonate link for every user action.
12
-
13
- This project rocks and uses MIT-LICENSE.
14
-
15
- #### Copyright
16
-
17
- &copy; 2013 [Boris Nadion](mailto:boris@astrails.com)
@@ -1,2 +0,0 @@
1
- Rails.application.routes.draw do
2
- end
@@ -1,4 +0,0 @@
1
- module RailsAdminImpersonate
2
- class Engine < ::Rails::Engine
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- # desc "Explaining what the task does"
2
- # task :rails_admin_impersonate do
3
- # # Task goes here
4
- # end