monarchy 2.6.1 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 501c75c0e0c7398fbf09926edec9a947834f830fa84e70fe7b8bcec30d6c73a9
4
- data.tar.gz: a6443c05f98584161476c5e9de927c5816c04514edd3d305ffa7b98febe0fb1f
3
+ metadata.gz: 242a8ab31e759d8cb38f0c53860754a672c759881b6a19eab7ad4a53573bee00
4
+ data.tar.gz: 3e2d0cfc4c02e6b83f9d8e2fd56f6a3d4c183c25db71be954f07dc064b062a6f
5
5
  SHA512:
6
- metadata.gz: d853d72a783cd8eb2474539c2cd8c96871c8833ee2da68b62fb08765972606e207ce71eaf34fbb1fc63471aff95ebf872f7d4be40867dab394a859e09f244e41
7
- data.tar.gz: 5c0176bd85b7b4ad52dcd0a3ee83e92e857887ddb9cbdda744e0a743fbc4a443c486392f6a8af541c8d3b84f7d6e539015fbb8baebe74efa8a7c11d203f56925
6
+ metadata.gz: 9ee73b87fb88ccad463e72b99e1e7333fa6933638648abf93f892233b11700186dc1e8659edb9ef376ef9d23d6274fecf20e3bd7a9bdc49858c81704fc1e4346
7
+ data.tar.gz: 073d6326482f506ff1d3399a8334bfb2d486132d65fbfe4c5198d90c7ebac077f5c8398f9b9bb3cce835c98743f067c1c552ae56a2521a41c1a98f9adbd333f9
@@ -1 +1 @@
1
- future-release=2.6.1
1
+ future-release=2.7.0
@@ -1,7 +1,7 @@
1
1
  require: rubocop-rspec
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.5
4
+ TargetRubyVersion: 2.6
5
5
  Exclude:
6
6
  - 'dummy/db/seeds.rb'
7
7
  - 'dummy/db/migrate/**'
@@ -21,8 +21,6 @@ Style/StructInheritance:
21
21
  Enabled: false
22
22
  Style/ClassAndModuleChildren:
23
23
  Enabled: false
24
- Rails/HasAndBelongsToMany:
25
- Enabled: false
26
24
  Style/MixinGrouping:
27
25
  Exclude:
28
26
  - 'spec/**/*.rb'
@@ -30,4 +28,16 @@ Lint/AmbiguousBlockAssociation:
30
28
  Exclude:
31
29
  - 'spec/**/*.rb'
32
30
  Gemspec/RequiredRubyVersion:
31
+ Enabled: false
32
+ RSpec/ContextWording:
33
+ Enabled: false
34
+ RSpec/NestedGroups:
35
+ Enabled: false
36
+ RSpec/LetSetup:
37
+ Enabled: false
38
+ RSpec/NamedSubject:
39
+ Enabled: false
40
+ RSpec/FilePath:
41
+ Enabled: false
42
+ RSpec/MultipleExpectations:
33
43
  Enabled: false
@@ -1,7 +1,7 @@
1
1
  # Change Log
2
2
 
3
- ## [2.6.0](https://github.com/Exelord/Monarchy/tree/2.6.0) (2018-12-19)
4
- [Full Changelog](https://github.com/Exelord/Monarchy/compare/v2.5.0...2.6.0)
3
+ ## [v2.6.0](https://github.com/Exelord/Monarchy/tree/v2.6.0) (2018-12-19)
4
+ [Full Changelog](https://github.com/Exelord/Monarchy/compare/v2.5.0...v2.6.0)
5
5
 
6
6
  **Merged pull requests:**
7
7
 
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  source 'https://rubygems.org'
4
- ruby '2.5.3'
4
+ ruby '2.6.3'
5
5
 
6
6
  # Declare your gem's dependencies in monarchy.gemspec.
7
7
  # Bundler will treat runtime dependencies like base dependencies, and
@@ -20,17 +20,17 @@ group :development, :test do
20
20
  gem 'bundler', '~> 1.17'
21
21
  gem 'database_cleaner', '1.7.0'
22
22
  gem 'db-query-matchers', '0.9.0'
23
- gem 'factory_bot_rails', '4.11.1'
24
- gem 'ffaker', '2.10.0'
25
- gem 'pry-rails', '0.3.8'
26
- gem 'rails', '5.2.2'
23
+ gem 'factory_bot_rails', '5.0.2'
24
+ gem 'ffaker', '2.12.0'
25
+ gem 'pry-rails', '0.3.9'
26
+ gem 'rails', '6.0.0'
27
27
  gem 'rake', '~> 12.3.2'
28
28
  gem 'rspec', '3.8.0'
29
- gem 'rspec-rails', '3.8.1'
30
- gem 'rubocop', '0.61.1'
31
- gem 'rubocop-rspec', '1.30.1'
32
- gem 'shoulda-matchers', '3.1.2'
33
- gem 'sqlite3', '1.3.13'
29
+ gem 'rspec-rails', '3.8.2'
30
+ gem 'rubocop', '0.74.0'
31
+ gem 'rubocop-rspec', '1.35.0'
32
+ gem 'shoulda-matchers', '4.1.2'
33
+ gem 'sqlite3', '1.4.1'
34
34
  end
35
35
 
36
- gem 'simplecov', '0.16.1', group: :test
36
+ gem 'simplecov', '0.17.0', group: :test
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- monarchy (2.6.0)
4
+ monarchy (2.6.1)
5
5
  active_record_union (= 1.3.0)
6
6
  activerecord (>= 4.2.7.1)
7
7
  closure_tree (= 7.0.0)
@@ -11,57 +11,70 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- actioncable (5.2.2)
15
- actionpack (= 5.2.2)
14
+ actioncable (6.0.0)
15
+ actionpack (= 6.0.0)
16
16
  nio4r (~> 2.0)
17
17
  websocket-driver (>= 0.6.1)
18
- actionmailer (5.2.2)
19
- actionpack (= 5.2.2)
20
- actionview (= 5.2.2)
21
- activejob (= 5.2.2)
18
+ actionmailbox (6.0.0)
19
+ actionpack (= 6.0.0)
20
+ activejob (= 6.0.0)
21
+ activerecord (= 6.0.0)
22
+ activestorage (= 6.0.0)
23
+ activesupport (= 6.0.0)
24
+ mail (>= 2.7.1)
25
+ actionmailer (6.0.0)
26
+ actionpack (= 6.0.0)
27
+ actionview (= 6.0.0)
28
+ activejob (= 6.0.0)
22
29
  mail (~> 2.5, >= 2.5.4)
23
30
  rails-dom-testing (~> 2.0)
24
- actionpack (5.2.2)
25
- actionview (= 5.2.2)
26
- activesupport (= 5.2.2)
31
+ actionpack (6.0.0)
32
+ actionview (= 6.0.0)
33
+ activesupport (= 6.0.0)
27
34
  rack (~> 2.0)
28
35
  rack-test (>= 0.6.3)
29
36
  rails-dom-testing (~> 2.0)
30
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
31
- actionview (5.2.2)
32
- activesupport (= 5.2.2)
37
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
38
+ actiontext (6.0.0)
39
+ actionpack (= 6.0.0)
40
+ activerecord (= 6.0.0)
41
+ activestorage (= 6.0.0)
42
+ activesupport (= 6.0.0)
43
+ nokogiri (>= 1.8.5)
44
+ actionview (6.0.0)
45
+ activesupport (= 6.0.0)
33
46
  builder (~> 3.1)
34
47
  erubi (~> 1.4)
35
48
  rails-dom-testing (~> 2.0)
36
- rails-html-sanitizer (~> 1.0, >= 1.0.3)
49
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
37
50
  active_record_union (1.3.0)
38
51
  activerecord (>= 4.0)
39
- activejob (5.2.2)
40
- activesupport (= 5.2.2)
52
+ activejob (6.0.0)
53
+ activesupport (= 6.0.0)
41
54
  globalid (>= 0.3.6)
42
- activemodel (5.2.2)
43
- activesupport (= 5.2.2)
44
- activerecord (5.2.2)
45
- activemodel (= 5.2.2)
46
- activesupport (= 5.2.2)
47
- arel (>= 9.0)
48
- activestorage (5.2.2)
49
- actionpack (= 5.2.2)
50
- activerecord (= 5.2.2)
55
+ activemodel (6.0.0)
56
+ activesupport (= 6.0.0)
57
+ activerecord (6.0.0)
58
+ activemodel (= 6.0.0)
59
+ activesupport (= 6.0.0)
60
+ activestorage (6.0.0)
61
+ actionpack (= 6.0.0)
62
+ activejob (= 6.0.0)
63
+ activerecord (= 6.0.0)
51
64
  marcel (~> 0.3.1)
52
- activesupport (5.2.2)
65
+ activesupport (6.0.0)
53
66
  concurrent-ruby (~> 1.0, >= 1.0.2)
54
67
  i18n (>= 0.7, < 2)
55
68
  minitest (~> 5.1)
56
69
  tzinfo (~> 1.1)
57
- arel (9.0.0)
70
+ zeitwerk (~> 2.1, >= 2.1.8)
58
71
  ast (2.4.0)
59
72
  builder (3.2.3)
60
73
  closure_tree (7.0.0)
61
74
  activerecord (>= 4.2.10)
62
75
  with_advisory_lock (>= 4.0.0)
63
76
  coderay (1.1.2)
64
- concurrent-ruby (1.1.4)
77
+ concurrent-ruby (1.1.5)
65
78
  configurations (2.2.2)
66
79
  crass (1.0.4)
67
80
  database_cleaner (1.7.0)
@@ -69,20 +82,20 @@ GEM
69
82
  activesupport (>= 4.0, <= 6.0)
70
83
  rspec (~> 3.0)
71
84
  diff-lcs (1.3)
72
- docile (1.3.1)
85
+ docile (1.3.2)
73
86
  erubi (1.8.0)
74
- factory_bot (4.11.1)
75
- activesupport (>= 3.0.0)
76
- factory_bot_rails (4.11.1)
77
- factory_bot (~> 4.11.1)
78
- railties (>= 3.0.0)
79
- ffaker (2.10.0)
80
- globalid (0.4.1)
87
+ factory_bot (5.0.2)
81
88
  activesupport (>= 4.2.0)
82
- i18n (1.2.0)
89
+ factory_bot_rails (5.0.2)
90
+ factory_bot (~> 5.0.2)
91
+ railties (>= 4.2.0)
92
+ ffaker (2.12.0)
93
+ globalid (0.4.2)
94
+ activesupport (>= 4.2.0)
95
+ i18n (1.6.0)
83
96
  concurrent-ruby (~> 1.0)
84
- jaro_winkler (1.5.1)
85
- json (2.1.0)
97
+ jaro_winkler (1.5.3)
98
+ json (2.2.0)
86
99
  loofah (2.2.3)
87
100
  crass (~> 1.0.2)
88
101
  nokogiri (>= 1.5.9)
@@ -91,64 +104,65 @@ GEM
91
104
  marcel (0.3.3)
92
105
  mimemagic (~> 0.3.2)
93
106
  method_source (0.9.2)
94
- mimemagic (0.3.2)
95
- mini_mime (1.0.1)
107
+ mimemagic (0.3.3)
108
+ mini_mime (1.0.2)
96
109
  mini_portile2 (2.4.0)
97
110
  minitest (5.11.3)
98
- nio4r (2.3.1)
99
- nokogiri (1.9.1)
111
+ nio4r (2.5.1)
112
+ nokogiri (1.10.4)
100
113
  mini_portile2 (~> 2.4.0)
101
- parallel (1.12.1)
102
- parser (2.5.3.0)
114
+ parallel (1.17.0)
115
+ parser (2.6.4.0)
103
116
  ast (~> 2.4.0)
104
- powerpack (0.1.2)
105
117
  pry (0.12.2)
106
118
  coderay (~> 1.1.0)
107
119
  method_source (~> 0.9.0)
108
- pry-rails (0.3.8)
120
+ pry-rails (0.3.9)
109
121
  pry (>= 0.10.4)
110
- rack (2.0.6)
122
+ rack (2.0.7)
111
123
  rack-test (1.1.0)
112
124
  rack (>= 1.0, < 3)
113
- rails (5.2.2)
114
- actioncable (= 5.2.2)
115
- actionmailer (= 5.2.2)
116
- actionpack (= 5.2.2)
117
- actionview (= 5.2.2)
118
- activejob (= 5.2.2)
119
- activemodel (= 5.2.2)
120
- activerecord (= 5.2.2)
121
- activestorage (= 5.2.2)
122
- activesupport (= 5.2.2)
125
+ rails (6.0.0)
126
+ actioncable (= 6.0.0)
127
+ actionmailbox (= 6.0.0)
128
+ actionmailer (= 6.0.0)
129
+ actionpack (= 6.0.0)
130
+ actiontext (= 6.0.0)
131
+ actionview (= 6.0.0)
132
+ activejob (= 6.0.0)
133
+ activemodel (= 6.0.0)
134
+ activerecord (= 6.0.0)
135
+ activestorage (= 6.0.0)
136
+ activesupport (= 6.0.0)
123
137
  bundler (>= 1.3.0)
124
- railties (= 5.2.2)
138
+ railties (= 6.0.0)
125
139
  sprockets-rails (>= 2.0.0)
126
140
  rails-dom-testing (2.0.3)
127
141
  activesupport (>= 4.2.0)
128
142
  nokogiri (>= 1.6)
129
- rails-html-sanitizer (1.0.4)
143
+ rails-html-sanitizer (1.2.0)
130
144
  loofah (~> 2.2, >= 2.2.2)
131
- railties (5.2.2)
132
- actionpack (= 5.2.2)
133
- activesupport (= 5.2.2)
145
+ railties (6.0.0)
146
+ actionpack (= 6.0.0)
147
+ activesupport (= 6.0.0)
134
148
  method_source
135
149
  rake (>= 0.8.7)
136
- thor (>= 0.19.0, < 2.0)
150
+ thor (>= 0.20.3, < 2.0)
137
151
  rainbow (3.0.0)
138
- rake (12.3.2)
152
+ rake (12.3.3)
139
153
  rspec (3.8.0)
140
154
  rspec-core (~> 3.8.0)
141
155
  rspec-expectations (~> 3.8.0)
142
156
  rspec-mocks (~> 3.8.0)
143
- rspec-core (3.8.0)
157
+ rspec-core (3.8.2)
144
158
  rspec-support (~> 3.8.0)
145
- rspec-expectations (3.8.2)
159
+ rspec-expectations (3.8.4)
146
160
  diff-lcs (>= 1.2.0, < 2.0)
147
161
  rspec-support (~> 3.8.0)
148
- rspec-mocks (3.8.0)
162
+ rspec-mocks (3.8.1)
149
163
  diff-lcs (>= 1.2.0, < 2.0)
150
164
  rspec-support (~> 3.8.0)
151
- rspec-rails (3.8.1)
165
+ rspec-rails (3.8.2)
152
166
  actionpack (>= 3.0)
153
167
  activesupport (>= 3.0)
154
168
  railties (>= 3.0)
@@ -156,21 +170,20 @@ GEM
156
170
  rspec-expectations (~> 3.8.0)
157
171
  rspec-mocks (~> 3.8.0)
158
172
  rspec-support (~> 3.8.0)
159
- rspec-support (3.8.0)
160
- rubocop (0.61.1)
173
+ rspec-support (3.8.2)
174
+ rubocop (0.74.0)
161
175
  jaro_winkler (~> 1.5.1)
162
176
  parallel (~> 1.10)
163
- parser (>= 2.5, != 2.5.1.1)
164
- powerpack (~> 0.1)
177
+ parser (>= 2.6)
165
178
  rainbow (>= 2.2.2, < 4.0)
166
179
  ruby-progressbar (~> 1.7)
167
- unicode-display_width (~> 1.4.0)
168
- rubocop-rspec (1.30.1)
180
+ unicode-display_width (>= 1.4.0, < 1.7)
181
+ rubocop-rspec (1.35.0)
169
182
  rubocop (>= 0.60.0)
170
- ruby-progressbar (1.10.0)
171
- shoulda-matchers (3.1.2)
172
- activesupport (>= 4.0.0)
173
- simplecov (0.16.1)
183
+ ruby-progressbar (1.10.1)
184
+ shoulda-matchers (4.1.2)
185
+ activesupport (>= 4.2.0)
186
+ simplecov (0.17.0)
174
187
  docile (~> 1.1)
175
188
  json (>= 1.8, < 3)
176
189
  simplecov-html (~> 0.10.0)
@@ -182,18 +195,19 @@ GEM
182
195
  actionpack (>= 4.0)
183
196
  activesupport (>= 4.0)
184
197
  sprockets (>= 3.0.0)
185
- sqlite3 (1.3.13)
198
+ sqlite3 (1.4.1)
186
199
  thor (0.20.3)
187
200
  thread_safe (0.3.6)
188
201
  tqdm (0.3.0)
189
202
  tzinfo (1.2.5)
190
203
  thread_safe (~> 0.1)
191
- unicode-display_width (1.4.0)
192
- websocket-driver (0.7.0)
204
+ unicode-display_width (1.6.0)
205
+ websocket-driver (0.7.1)
193
206
  websocket-extensions (>= 0.1.0)
194
- websocket-extensions (0.1.3)
207
+ websocket-extensions (0.1.4)
195
208
  with_advisory_lock (4.0.0)
196
209
  activerecord (>= 4.2)
210
+ zeitwerk (2.1.9)
197
211
 
198
212
  PLATFORMS
199
213
  ruby
@@ -202,22 +216,22 @@ DEPENDENCIES
202
216
  bundler (~> 1.17)
203
217
  database_cleaner (= 1.7.0)
204
218
  db-query-matchers (= 0.9.0)
205
- factory_bot_rails (= 4.11.1)
206
- ffaker (= 2.10.0)
219
+ factory_bot_rails (= 5.0.2)
220
+ ffaker (= 2.12.0)
207
221
  monarchy!
208
- pry-rails (= 0.3.8)
209
- rails (= 5.2.2)
222
+ pry-rails (= 0.3.9)
223
+ rails (= 6.0.0)
210
224
  rake (~> 12.3.2)
211
225
  rspec (= 3.8.0)
212
- rspec-rails (= 3.8.1)
213
- rubocop (= 0.61.1)
214
- rubocop-rspec (= 1.30.1)
215
- shoulda-matchers (= 3.1.2)
216
- simplecov (= 0.16.1)
217
- sqlite3 (= 1.3.13)
226
+ rspec-rails (= 3.8.2)
227
+ rubocop (= 0.74.0)
228
+ rubocop-rspec (= 1.35.0)
229
+ shoulda-matchers (= 4.1.2)
230
+ simplecov (= 0.17.0)
231
+ sqlite3 (= 1.4.1)
218
232
 
219
233
  RUBY VERSION
220
- ruby 2.5.3p105
234
+ ruby 2.6.3p62
221
235
 
222
236
  BUNDLED WITH
223
- 1.17.2
237
+ 1.17.3
@@ -19,7 +19,5 @@ module Dummy
19
19
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20
20
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21
21
  # config.i18n.default_locale = :de
22
-
23
- config.active_record.sqlite3.represent_boolean_as_integer = true
24
22
  end
25
23
  end
data/dummy/spec CHANGED
@@ -1 +1 @@
1
- dummy/../spec
1
+ ../spec
@@ -70,11 +70,13 @@ module Monarchy
70
70
 
71
71
  module SupportMethods
72
72
  def accessible_roots_ids(user_id, parent_access)
73
+ user_query = sanitize_sql_for_assignment(['INNER JOIN (SELECT hierarchy_id FROM monarchy_members ' \
74
+ 'WHERE monarchy_members.user_id = ?) as members ON ' \
75
+ 'members.hierarchy_id = monarchy_hierarchy_hierarchies.descendant_id', user_id])
76
+
73
77
  accessible_roots = unscoped.joins('INNER JOIN monarchy_hierarchy_hierarchies ON ' \
74
78
  'monarchy_hierarchies.id = monarchy_hierarchy_hierarchies.ancestor_id')
75
- .joins('INNER JOIN (SELECT hierarchy_id FROM monarchy_members ' \
76
- "WHERE monarchy_members.user_id = #{user_id}) as members ON " \
77
- 'members.hierarchy_id = monarchy_hierarchy_hierarchies.descendant_id').select(:id)
79
+ .joins(user_query).select(:id)
78
80
 
79
81
  parent_access ? roots_with_children(accessible_roots) : accessible_roots
80
82
  end
@@ -131,11 +133,13 @@ module Monarchy
131
133
  end
132
134
 
133
135
  def ancestor_leaves_for_user(user_id, inherited, inherited_roles = [])
136
+ user_query = sanitize_sql_for_assignment(['INNER JOIN (SELECT id, hierarchy_id FROM monarchy_members WHERE ' \
137
+ 'user_id = ?) as monarchy_members ON monarchy_members.hierarchy_id = monarchy_hierarchies.id', user_id])
138
+
134
139
  unscoped
135
140
  .joins('INNER JOIN monarchy_hierarchy_hierarchies ON ' \
136
141
  'monarchy_hierarchies.id = monarchy_hierarchy_hierarchies.descendant_id')
137
- .joins('INNER JOIN (SELECT id, hierarchy_id FROM monarchy_members WHERE ' \
138
- "user_id = #{user_id}) as monarchy_members ON monarchy_members.hierarchy_id = monarchy_hierarchies.id")
142
+ .joins(user_query)
139
143
  .joins('INNER JOIN monarchy_members_roles ON monarchy_members_roles.member_id = monarchy_members.id')
140
144
  .joins("INNER JOIN (#{inheritance_query(inherited_roles, inherited)}) as " \
141
145
  'monarchy_roles ON monarchy_members_roles.role_id = monarchy_roles.id')
@@ -30,7 +30,7 @@ module Monarchy
30
30
  end
31
31
 
32
32
  def default_role
33
- @default_role ||= Monarchy.role_class.find_by(name: default_role_name)
33
+ Monarchy.role_class.find_by(name: default_role_name)
34
34
  end
35
35
 
36
36
  private
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Monarchy
4
- VERSION = '2.6.1'
4
+ VERSION = '2.7.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monarchy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Exelord
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-08 00:00:00.000000000 Z
11
+ date: 2019-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_record_union
@@ -216,8 +216,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
216
216
  - !ruby/object:Gem::Version
217
217
  version: '0'
218
218
  requirements: []
219
- rubyforge_project:
220
- rubygems_version: 2.7.6
219
+ rubygems_version: 3.0.4
221
220
  signing_key:
222
221
  specification_version: 4
223
222
  summary: Hierarchical access management system with roles inheritance.