devise_masquerade 0.6.5 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +5 -5
  2. data/.github/FUNDING.yml +1 -0
  3. data/.github/workflows/brakeman-analysis.yml +44 -0
  4. data/.github/workflows/rubocop-analysis.yml +39 -0
  5. data/.gitignore +1 -2
  6. data/.ruby-version +1 -1
  7. data/.travis.yml +3 -4
  8. data/Gemfile +16 -10
  9. data/Gemfile.lock +307 -0
  10. data/Makefile +6 -1
  11. data/README.md +33 -1
  12. data/app/controllers/devise/masquerades_controller.rb +75 -59
  13. data/devise_masquerade.gemspec +5 -4
  14. data/features/back.feature +0 -1
  15. data/features/multiple_masquerading_models.feature +17 -0
  16. data/features/step_definitions/auth_steps.rb +1 -0
  17. data/features/step_definitions/back_steps.rb +18 -3
  18. data/features/step_definitions/url_helpers_steps.rb +11 -0
  19. data/features/support/env.rb +23 -4
  20. data/features/url_helpers.feature +14 -0
  21. data/lib/devise_masquerade.rb +3 -9
  22. data/lib/devise_masquerade/controllers/helpers.rb +27 -8
  23. data/lib/devise_masquerade/controllers/url_helpers.rb +16 -2
  24. data/lib/devise_masquerade/models.rb +9 -0
  25. data/lib/devise_masquerade/models/masqueradable.rb +13 -0
  26. data/lib/devise_masquerade/rails.rb +14 -4
  27. data/lib/devise_masquerade/routes.rb +11 -8
  28. data/lib/devise_masquerade/version.rb +1 -1
  29. data/spec/controllers/admin/dashboard_controller_spec.rb +3 -4
  30. data/spec/controllers/dashboard_controller_spec.rb +3 -5
  31. data/spec/controllers/devise/masquerades_controller_spec.rb +62 -38
  32. data/spec/controllers/masquerades_tests_controller_spec.rb +41 -0
  33. data/spec/dummy/app/controllers/admin/dashboard_controller.rb +1 -2
  34. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  35. data/spec/dummy/app/controllers/dashboard_controller.rb +5 -2
  36. data/spec/dummy/app/controllers/masquerades_tests_controller.rb +7 -0
  37. data/spec/dummy/app/controllers/students_controller.rb +8 -0
  38. data/spec/dummy/app/models/admin/user.rb +0 -7
  39. data/spec/dummy/app/models/student.rb +3 -0
  40. data/spec/dummy/app/models/user.rb +1 -10
  41. data/spec/dummy/app/views/admin/dashboard/index.html.erb +0 -2
  42. data/spec/dummy/app/views/dashboard/extra_params.html.erb +7 -0
  43. data/spec/dummy/app/views/dashboard/index.html.erb +0 -2
  44. data/spec/dummy/app/views/layouts/application.html.erb +7 -1
  45. data/spec/dummy/app/views/students/_student.html.erb +6 -0
  46. data/spec/dummy/app/views/students/index.html.erb +1 -0
  47. data/spec/dummy/app/views/users/_user.html.erb +1 -1
  48. data/spec/dummy/config/application.rb +2 -0
  49. data/spec/dummy/config/environment.rb +1 -0
  50. data/spec/dummy/config/routes.rb +9 -5
  51. data/spec/dummy/db/.gitignore +1 -0
  52. data/spec/dummy/db/migrate/20121119085620_devise_create_users.rb +1 -1
  53. data/spec/dummy/db/migrate/20140418160449_create_admin_users.rb +1 -1
  54. data/spec/dummy/db/migrate/20191022100000_create_students.rb +14 -0
  55. data/spec/dummy/db/schema.rb +37 -31
  56. data/spec/models/user_spec.rb +3 -30
  57. data/spec/orm/active_record.rb +5 -2
  58. data/spec/spec_helper.rb +3 -3
  59. data/spec/support/factories.rb +13 -9
  60. metadata +57 -19
  61. data/lib/devise_masquerade/model.rb +0 -42
  62. data/spec/controllers/masquerades_controller_spec.rb +0 -42
  63. data/spec/dummy/app/controllers/masquerades_controller.rb +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 205c70db504c2947a36a81c7296d6482b195a2cf
4
- data.tar.gz: 50dc3a8fc22efd8f4375a5368039da3533fdd865
2
+ SHA256:
3
+ metadata.gz: 7e8cd4d05e6a1c75e17d26588532e261c01e95689d87d491757132d3242faed7
4
+ data.tar.gz: a9e581005ebf3f238f39aa83d276cef37716bbc1669462f2a4e80f745e29c70a
5
5
  SHA512:
6
- metadata.gz: 28b8161d8e6c3cf80d0dee9834abe5fc5cafa28b2361d5c331684a209bd68bee3eab26b94ee50cb30d80b6b44927110da396d6852f2aef655fabb451a02c8bf6
7
- data.tar.gz: 03c22856e74195605aac5d585be63fa1dbf0cca6ff0fd200ea3f0fe1b9e4ad70b33b4bfd2581809c5966c43f26f7ab85987b4fceab0bc192258e28562578c65e
6
+ metadata.gz: 27aee8dd6cfd3f270a466bc30c4a4b545c7b4e944c3794567ed6c220b86598ff2e5361cb00a7cb7a49d20fccc6532cbd97cd0e301459c5b980bbe2e6052847d8
7
+ data.tar.gz: 4df45047b964dd10855dbf563f907bedd5e497130cfab4e5b7d65168d5ca91d47265ea562aea1345563fe15b17f7e944b867dfae3420f4e9cbd030287952bc8f
@@ -0,0 +1 @@
1
+ patreon: oivoodoo
@@ -0,0 +1,44 @@
1
+ # This workflow integrates Brakeman with GitHub's Code Scanning feature
2
+ # Brakeman is a static analysis security vulnerability scanner for Ruby on Rails applications
3
+
4
+ name: Brakeman Scan
5
+
6
+ # This section configures the trigger for the workflow. Feel free to customize depending on your convention
7
+ on:
8
+ push:
9
+ branches: [ "master", "main" ]
10
+ pull_request:
11
+ branches: [ "master", "main" ]
12
+
13
+ jobs:
14
+ brakeman-scan:
15
+ name: Brakeman Scan
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ # Checkout the repository to the GitHub Actions runner
19
+ - name: Checkout
20
+ uses: actions/checkout@v2
21
+
22
+ # Customize the ruby version depending on your needs
23
+ - name: Setup Ruby
24
+ uses: actions/setup-ruby@v1
25
+ with:
26
+ ruby-version: '2.7'
27
+
28
+ - name: Setup Brakeman
29
+ env:
30
+ BRAKEMAN_VERSION: '4.10' # SARIF support is provided in Brakeman version 4.10+
31
+ run: |
32
+ gem install brakeman --version $BRAKEMAN_VERSION
33
+
34
+ # Execute Brakeman CLI and generate a SARIF output with the security issues identified during the analysis
35
+ - name: Scan
36
+ continue-on-error: true
37
+ run: |
38
+ brakeman -f sarif -o output.sarif.json .
39
+
40
+ # Upload the SARIF file generated in the previous step
41
+ - name: Upload SARIF
42
+ uses: github/codeql-action/upload-sarif@v1
43
+ with:
44
+ sarif_file: output.sarif.json
@@ -0,0 +1,39 @@
1
+ name: "Rubocop"
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ rubocop:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+
11
+ steps:
12
+ - name: Checkout repository
13
+ uses: actions/checkout@v2
14
+
15
+ # If running on a self-hosted runner, check it meets the requirements
16
+ # listed at https://github.com/ruby/setup-ruby#using-self-hosted-runners
17
+ - name: Set up Ruby
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: 2.6
21
+
22
+ # This step is not necessary if you add the gem to your Gemfile
23
+ - name: Install Code Scanning integration
24
+ run: bundle add code-scanning-rubocop --version 0.3.0 --skip-install
25
+
26
+ - name: Install dependencies
27
+ run: bundle install
28
+
29
+ - name: Rubocop run
30
+ run: |
31
+ bash -c "
32
+ bundle exec rubocop --require code_scanning --format CodeScanning::SarifFormatter -o rubocop.sarif
33
+ [[ $? -ne 2 ]]
34
+ "
35
+
36
+ - name: Upload Sarif output
37
+ uses: github/codeql-action/upload-sarif@v1
38
+ with:
39
+ sarif_file: rubocop.sarif
data/.gitignore CHANGED
@@ -3,7 +3,6 @@
3
3
  .bundle
4
4
  .config
5
5
  .yardoc
6
- Gemfile.lock
7
6
  InstalledFiles
8
7
  _yardoc
9
8
  coverage
@@ -19,4 +18,4 @@ spec/dummy/db/*.sqlite3
19
18
  tmp
20
19
  tags
21
20
  .vimrc
22
-
21
+ vendor/
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.3
1
+ 2.7.2
data/.travis.yml CHANGED
@@ -1,12 +1,11 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.5
4
- - 2.3.1
5
- - 2.3.3
3
+ - 2.5.1
4
+ - 2.6.0
5
+ - 2.7.2
6
6
  gemfile:
7
7
  - Gemfile
8
8
  script: time ./script/travis.sh
9
- cache: bundler
10
9
  sudo: false
11
10
  addons:
12
11
  apt:
data/Gemfile CHANGED
@@ -4,10 +4,10 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :test do
7
- gem 'activerecord', '~> 3.0'
8
- gem 'actionmailer', '~> 3.0'
9
- gem "bson_ext", "~> 1.3"
10
- gem 'sqlite3'
7
+ gem 'activerecord', '>= 5.2'
8
+ gem 'actionmailer', '>= 5.2'
9
+ gem 'bson_ext', '~> 1.3'
10
+ gem 'sqlite3', '~> 1.4'
11
11
 
12
12
  gem 'test-unit'
13
13
 
@@ -15,21 +15,27 @@ group :test do
15
15
  gem 'pry-byebug'
16
16
 
17
17
  gem 'guard'
18
- gem 'guard-rspec'
18
+ gem 'guard-rspec', '~> 4.7'
19
19
  gem 'guard-bundler'
20
20
  gem 'guard-cucumber'
21
21
 
22
- gem 'rspec-rails'
23
- gem 'rspec'
24
- gem 'rspec-mocks'
22
+ gem 'rspec', github: 'rspec/rspec'
23
+ gem 'rspec-core', github: 'rspec/rspec-core'
24
+ gem 'rspec-expectations', github: 'rspec/rspec-expectations'
25
+ gem 'rspec-mocks', github: 'rspec/rspec-mocks'
26
+ gem 'rspec-rails', github: 'rspec/rspec-rails'
27
+ gem 'rspec-support', github: 'rspec/rspec-support'
25
28
 
26
29
  gem 'shoulda'
27
30
  gem 'rb-fsevent'
28
- gem 'factory_girl_rails'
31
+ gem 'factory_bot_rails'
29
32
  gem 'database_cleaner', '< 1.1.0'
30
33
  gem 'cucumber'
31
34
  gem 'cucumber-rails'
32
35
  gem 'capybara'
33
- gem 'capybara-webkit'
36
+ gem 'selenium-webdriver'
37
+ gem 'chromedriver-helper'
34
38
  gem 'launchy'
39
+
40
+ gem "nokogiri", ">= 1.10.8"
35
41
  end
data/Gemfile.lock ADDED
@@ -0,0 +1,307 @@
1
+ GIT
2
+ remote: https://github.com/rspec/rspec-core.git
3
+ revision: b7067c5da4fde57cbbff739b168008482e61db44
4
+ specs:
5
+ rspec-core (3.10.0.pre)
6
+ rspec-support (= 3.10.0.pre)
7
+
8
+ GIT
9
+ remote: https://github.com/rspec/rspec-expectations.git
10
+ revision: 99f9bcaff2a6f3d82f4e350e829eca6ab015694f
11
+ specs:
12
+ rspec-expectations (3.10.0.pre)
13
+ diff-lcs (>= 1.2.0, < 2.0)
14
+ rspec-support (= 3.10.0.pre)
15
+
16
+ GIT
17
+ remote: https://github.com/rspec/rspec-mocks.git
18
+ revision: 5b897e8f74f3059aef43f1ed5f91719f2267a04e
19
+ specs:
20
+ rspec-mocks (3.10.0.pre)
21
+ diff-lcs (>= 1.2.0, < 2.0)
22
+ rspec-support (= 3.10.0.pre)
23
+
24
+ GIT
25
+ remote: https://github.com/rspec/rspec-rails.git
26
+ revision: 9b7ab39c027a8cb25e2ebe9e0e985756025b0549
27
+ specs:
28
+ rspec-rails (4.0.0.pre)
29
+ actionpack (>= 4.2)
30
+ activesupport (>= 4.2)
31
+ railties (>= 4.2)
32
+ rspec-core (= 3.10.0.pre)
33
+ rspec-expectations (= 3.10.0.pre)
34
+ rspec-mocks (= 3.10.0.pre)
35
+ rspec-support (= 3.10.0.pre)
36
+
37
+ GIT
38
+ remote: https://github.com/rspec/rspec-support.git
39
+ revision: 673133cdd13b17077b3d88ece8d7380821f8d7dc
40
+ specs:
41
+ rspec-support (3.10.0.pre)
42
+
43
+ GIT
44
+ remote: https://github.com/rspec/rspec.git
45
+ revision: e1c2c6bd78c849d7956431331f32ba5092951dab
46
+ specs:
47
+ rspec (3.10.0.pre)
48
+ rspec-core (= 3.10.0.pre)
49
+ rspec-expectations (= 3.10.0.pre)
50
+ rspec-mocks (= 3.10.0.pre)
51
+
52
+ PATH
53
+ remote: .
54
+ specs:
55
+ devise_masquerade (1.3.1)
56
+ devise (>= 4.7.0)
57
+ globalid (>= 0.3.6)
58
+ railties (>= 5.2.0)
59
+
60
+ GEM
61
+ remote: https://rubygems.org/
62
+ specs:
63
+ actionmailer (6.0.0)
64
+ actionpack (= 6.0.0)
65
+ actionview (= 6.0.0)
66
+ activejob (= 6.0.0)
67
+ mail (~> 2.5, >= 2.5.4)
68
+ rails-dom-testing (~> 2.0)
69
+ actionpack (6.0.0)
70
+ actionview (= 6.0.0)
71
+ activesupport (= 6.0.0)
72
+ rack (~> 2.0)
73
+ rack-test (>= 0.6.3)
74
+ rails-dom-testing (~> 2.0)
75
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
76
+ actionview (6.0.0)
77
+ activesupport (= 6.0.0)
78
+ builder (~> 3.1)
79
+ erubi (~> 1.4)
80
+ rails-dom-testing (~> 2.0)
81
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
82
+ activejob (6.0.0)
83
+ activesupport (= 6.0.0)
84
+ globalid (>= 0.3.6)
85
+ activemodel (6.0.0)
86
+ activesupport (= 6.0.0)
87
+ activerecord (6.0.0)
88
+ activemodel (= 6.0.0)
89
+ activesupport (= 6.0.0)
90
+ activesupport (6.0.0)
91
+ concurrent-ruby (~> 1.0, >= 1.0.2)
92
+ i18n (>= 0.7, < 2)
93
+ minitest (~> 5.1)
94
+ tzinfo (~> 1.1)
95
+ zeitwerk (~> 2.1, >= 2.1.8)
96
+ addressable (2.7.0)
97
+ public_suffix (>= 2.0.2, < 5.0)
98
+ archive-zip (0.12.0)
99
+ io-like (~> 0.3.0)
100
+ backports (3.15.0)
101
+ bcrypt (3.1.16)
102
+ bson (1.12.5)
103
+ bson_ext (1.12.5)
104
+ bson (~> 1.12.5)
105
+ builder (3.2.3)
106
+ byebug (11.0.1)
107
+ capybara (3.29.0)
108
+ addressable
109
+ mini_mime (>= 0.1.3)
110
+ nokogiri (~> 1.8)
111
+ rack (>= 1.6.0)
112
+ rack-test (>= 0.6.3)
113
+ regexp_parser (~> 1.5)
114
+ xpath (~> 3.2)
115
+ childprocess (3.0.0)
116
+ chromedriver-helper (2.1.1)
117
+ archive-zip (~> 0.10)
118
+ nokogiri (~> 1.8)
119
+ coderay (1.1.2)
120
+ concurrent-ruby (1.1.5)
121
+ crass (1.0.5)
122
+ cucumber (3.1.2)
123
+ builder (>= 2.1.2)
124
+ cucumber-core (~> 3.2.0)
125
+ cucumber-expressions (~> 6.0.1)
126
+ cucumber-wire (~> 0.0.1)
127
+ diff-lcs (~> 1.3)
128
+ gherkin (~> 5.1.0)
129
+ multi_json (>= 1.7.5, < 2.0)
130
+ multi_test (>= 0.1.2)
131
+ cucumber-core (3.2.1)
132
+ backports (>= 3.8.0)
133
+ cucumber-tag_expressions (~> 1.1.0)
134
+ gherkin (~> 5.0)
135
+ cucumber-expressions (6.0.1)
136
+ cucumber-rails (1.8.0)
137
+ capybara (>= 2.12, < 4)
138
+ cucumber (>= 3.0.2, < 4)
139
+ mime-types (>= 2.0, < 4)
140
+ nokogiri (~> 1.8)
141
+ railties (>= 4.2, < 7)
142
+ cucumber-tag_expressions (1.1.1)
143
+ cucumber-wire (0.0.1)
144
+ database_cleaner (1.0.1)
145
+ devise (4.7.3)
146
+ bcrypt (~> 3.0)
147
+ orm_adapter (~> 0.1)
148
+ railties (>= 4.1.0)
149
+ responders
150
+ warden (~> 1.2.3)
151
+ diff-lcs (1.3)
152
+ erubi (1.9.0)
153
+ factory_bot (5.1.1)
154
+ activesupport (>= 4.2.0)
155
+ factory_bot_rails (5.1.1)
156
+ factory_bot (~> 5.1.0)
157
+ railties (>= 4.2.0)
158
+ ffi (1.11.1)
159
+ formatador (0.2.5)
160
+ gherkin (5.1.0)
161
+ globalid (0.4.2)
162
+ activesupport (>= 4.2.0)
163
+ guard (2.15.1)
164
+ formatador (>= 0.2.4)
165
+ listen (>= 2.7, < 4.0)
166
+ lumberjack (>= 1.0.12, < 2.0)
167
+ nenv (~> 0.1)
168
+ notiffany (~> 0.0)
169
+ pry (>= 0.9.12)
170
+ shellany (~> 0.0)
171
+ thor (>= 0.18.1)
172
+ guard-bundler (2.2.1)
173
+ bundler (>= 1.3.0, < 3)
174
+ guard (~> 2.2)
175
+ guard-compat (~> 1.1)
176
+ guard-compat (1.2.1)
177
+ guard-cucumber (1.5.4)
178
+ cucumber (>= 1.3.0)
179
+ guard-compat (~> 1.0)
180
+ nenv (~> 0.1)
181
+ guard-rspec (4.7.3)
182
+ guard (~> 2.1)
183
+ guard-compat (~> 1.1)
184
+ rspec (>= 2.99.0, < 4.0)
185
+ i18n (1.7.0)
186
+ concurrent-ruby (~> 1.0)
187
+ io-like (0.3.0)
188
+ launchy (2.4.3)
189
+ addressable (~> 2.3)
190
+ listen (3.2.0)
191
+ rb-fsevent (~> 0.10, >= 0.10.3)
192
+ rb-inotify (~> 0.9, >= 0.9.10)
193
+ loofah (2.3.1)
194
+ crass (~> 1.0.2)
195
+ nokogiri (>= 1.5.9)
196
+ lumberjack (1.0.13)
197
+ mail (2.7.1)
198
+ mini_mime (>= 0.1.1)
199
+ method_source (0.9.2)
200
+ mime-types (3.3)
201
+ mime-types-data (~> 3.2015)
202
+ mime-types-data (3.2019.1009)
203
+ mini_mime (1.0.2)
204
+ mini_portile2 (2.5.0)
205
+ minitest (5.12.2)
206
+ multi_json (1.14.1)
207
+ multi_test (0.1.2)
208
+ nenv (0.3.0)
209
+ nokogiri (1.11.1)
210
+ mini_portile2 (~> 2.5.0)
211
+ racc (~> 1.4)
212
+ notiffany (0.1.3)
213
+ nenv (~> 0.1)
214
+ shellany (~> 0.0)
215
+ orm_adapter (0.5.0)
216
+ power_assert (1.1.5)
217
+ pry (0.12.2)
218
+ coderay (~> 1.1.0)
219
+ method_source (~> 0.9.0)
220
+ pry-byebug (3.7.0)
221
+ byebug (~> 11.0)
222
+ pry (~> 0.10)
223
+ public_suffix (4.0.1)
224
+ racc (1.5.2)
225
+ rack (2.2.3)
226
+ rack-test (1.1.0)
227
+ rack (>= 1.0, < 3)
228
+ rails-dom-testing (2.0.3)
229
+ activesupport (>= 4.2.0)
230
+ nokogiri (>= 1.6)
231
+ rails-html-sanitizer (1.3.0)
232
+ loofah (~> 2.3)
233
+ railties (6.0.0)
234
+ actionpack (= 6.0.0)
235
+ activesupport (= 6.0.0)
236
+ method_source
237
+ rake (>= 0.8.7)
238
+ thor (>= 0.20.3, < 2.0)
239
+ rake (13.0.0)
240
+ rb-fsevent (0.10.3)
241
+ rb-inotify (0.10.0)
242
+ ffi (~> 1.0)
243
+ regexp_parser (1.6.0)
244
+ responders (3.0.1)
245
+ actionpack (>= 5.0)
246
+ railties (>= 5.0)
247
+ rubyzip (2.0.0)
248
+ selenium-webdriver (3.142.6)
249
+ childprocess (>= 0.5, < 4.0)
250
+ rubyzip (>= 1.2.2)
251
+ shellany (0.0.1)
252
+ shoulda (3.6.0)
253
+ shoulda-context (~> 1.0, >= 1.0.1)
254
+ shoulda-matchers (~> 3.0)
255
+ shoulda-context (1.2.2)
256
+ shoulda-matchers (3.1.3)
257
+ activesupport (>= 4.0.0)
258
+ sqlite3 (1.4.1)
259
+ test-unit (3.3.4)
260
+ power_assert
261
+ thor (0.20.3)
262
+ thread_safe (0.3.6)
263
+ tzinfo (1.2.5)
264
+ thread_safe (~> 0.1)
265
+ warden (1.2.9)
266
+ rack (>= 2.0.9)
267
+ xpath (3.2.0)
268
+ nokogiri (~> 1.8)
269
+ zeitwerk (2.2.0)
270
+
271
+ PLATFORMS
272
+ ruby
273
+
274
+ DEPENDENCIES
275
+ actionmailer (>= 5.2)
276
+ activerecord (>= 5.2)
277
+ bson_ext (~> 1.3)
278
+ bundler (>= 2.0.0)
279
+ capybara
280
+ chromedriver-helper
281
+ cucumber
282
+ cucumber-rails
283
+ database_cleaner (< 1.1.0)
284
+ devise_masquerade!
285
+ factory_bot_rails
286
+ guard
287
+ guard-bundler
288
+ guard-cucumber
289
+ guard-rspec (~> 4.7)
290
+ launchy
291
+ nokogiri (>= 1.10.8)
292
+ pry
293
+ pry-byebug
294
+ rb-fsevent
295
+ rspec!
296
+ rspec-core!
297
+ rspec-expectations!
298
+ rspec-mocks!
299
+ rspec-rails!
300
+ rspec-support!
301
+ selenium-webdriver
302
+ shoulda
303
+ sqlite3 (~> 1.4)
304
+ test-unit
305
+
306
+ BUNDLED WITH
307
+ 2.1.4