esp-permissions 0.0.7.1 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,7 @@ class EspPermissions::UsersController < EspPermissions::ApplicationController
3
3
 
4
4
  actions :index, :new, :create, :destroy, :search
5
5
 
6
+ has_scope :with_permissions, :default => 1
6
7
  has_scope :page, :default => 1
7
8
 
8
9
  def search
@@ -17,6 +18,7 @@ class EspPermissions::UsersController < EspPermissions::ApplicationController
17
18
  def search_and_paginate_collection
18
19
  if params[:utf8]
19
20
  search_object = searcher_for(resource_instance_name)
21
+ search_object.permissions_count_gt = 1
20
22
  search_object.pagination = paginate_options
21
23
  search_object.results
22
24
  else
@@ -1,5 +1,6 @@
1
1
  class UserSearch < Search
2
2
  column :keywords, :text
3
+ column :permissions_count_gt, :integer
3
4
  end
4
5
 
5
6
  # == Schema Information
@@ -1,3 +1,3 @@
1
1
  module EspPermissions
2
- VERSION = "0.0.7.1"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -25,6 +25,7 @@ module EspPermissions
25
25
  def create_migration
26
26
  migration_template 'db/migrate/esp_permissions_create_contexts.rb'
27
27
  migration_template 'db/migrate/esp_permissions_create_permissions.rb'
28
+ migration_template 'db/migrate/esp_permissions_add_permissions_count_to_users.rb'
28
29
  end
29
30
 
30
31
  end
@@ -1,6 +1,6 @@
1
1
  class Permission < ActiveRecord::Base
2
2
  belongs_to :context
3
- belongs_to :user
3
+ belongs_to :user, :counter_cache => true
4
4
  has_enum :role, :scopes => true
5
5
 
6
6
  attr_accessor :user_search, :user_uid, :user_first_name, :user_last_name, :user_email
@@ -10,8 +10,11 @@ class User < ActiveRecord::Base
10
10
 
11
11
  searchable do
12
12
  text :name, :email, :nickname, :phone, :last_name, :first_name
13
+ integer :permissions_count
13
14
  end
14
15
 
16
+ scope :with_permissions, where('permissions_count > 0')
17
+
15
18
  def self.from_omniauth(hash)
16
19
  User.find_or_initialize_by_uid(hash['uid']).tap do |user|
17
20
  user.update_attributes hash['info']
@@ -0,0 +1,5 @@
1
+ class EspPermissionsAddPermissionsCountToUsers < ActiveRecord::Migration
2
+ def change
3
+ add_column :users, :permissions_count, :integer
4
+ end
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esp-permissions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7.1
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ancestry
16
- requirement: &23402120 !ruby/object:Gem::Requirement
16
+ requirement: &12246580 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *23402120
24
+ version_requirements: *12246580
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: cancan
27
- requirement: &23401700 !ruby/object:Gem::Requirement
27
+ requirement: &12246040 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *23401700
35
+ version_requirements: *12246040
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: compass
38
- requirement: &23389060 !ruby/object:Gem::Requirement
38
+ requirement: &12245520 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.12.alpha.2
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *23389060
46
+ version_requirements: *12245520
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: curb
49
- requirement: &23388640 !ruby/object:Gem::Requirement
49
+ requirement: &12245080 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *23388640
57
+ version_requirements: *12245080
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: formtastic
60
- requirement: &23388160 !ruby/object:Gem::Requirement
60
+ requirement: &12244560 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *23388160
68
+ version_requirements: *12244560
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: has_enum
71
- requirement: &23387740 !ruby/object:Gem::Requirement
71
+ requirement: &12244140 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *23387740
79
+ version_requirements: *12244140
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: has_searcher
82
- requirement: &23387320 !ruby/object:Gem::Requirement
82
+ requirement: &12243680 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,21 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *23387320
90
+ version_requirements: *12243680
91
+ - !ruby/object:Gem::Dependency
92
+ name: has_scope
93
+ requirement: &12243240 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :runtime
100
+ prerelease: false
101
+ version_requirements: *12243240
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: inherited_resources
93
- requirement: &23386900 !ruby/object:Gem::Requirement
104
+ requirement: &12242820 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ! '>='
@@ -98,10 +109,10 @@ dependencies:
98
109
  version: '0'
99
110
  type: :runtime
100
111
  prerelease: false
101
- version_requirements: *23386900
112
+ version_requirements: *12242820
102
113
  - !ruby/object:Gem::Dependency
103
114
  name: kaminari
104
- requirement: &23386480 !ruby/object:Gem::Requirement
115
+ requirement: &12242380 !ruby/object:Gem::Requirement
105
116
  none: false
106
117
  requirements:
107
118
  - - ! '>='
@@ -109,10 +120,10 @@ dependencies:
109
120
  version: '0'
110
121
  type: :runtime
111
122
  prerelease: false
112
- version_requirements: *23386480
123
+ version_requirements: *12242380
113
124
  - !ruby/object:Gem::Dependency
114
125
  name: progress_bar
115
- requirement: &23386060 !ruby/object:Gem::Requirement
126
+ requirement: &12241960 !ruby/object:Gem::Requirement
116
127
  none: false
117
128
  requirements:
118
129
  - - ! '>='
@@ -120,10 +131,10 @@ dependencies:
120
131
  version: '0'
121
132
  type: :runtime
122
133
  prerelease: false
123
- version_requirements: *23386060
134
+ version_requirements: *12241960
124
135
  - !ruby/object:Gem::Dependency
125
136
  name: rails
126
- requirement: &23385640 !ruby/object:Gem::Requirement
137
+ requirement: &12241540 !ruby/object:Gem::Requirement
127
138
  none: false
128
139
  requirements:
129
140
  - - ! '>='
@@ -131,10 +142,10 @@ dependencies:
131
142
  version: '0'
132
143
  type: :runtime
133
144
  prerelease: false
134
- version_requirements: *23385640
145
+ version_requirements: *12241540
135
146
  - !ruby/object:Gem::Dependency
136
147
  name: sass
137
- requirement: &23385220 !ruby/object:Gem::Requirement
148
+ requirement: &12240920 !ruby/object:Gem::Requirement
138
149
  none: false
139
150
  requirements:
140
151
  - - ! '>='
@@ -142,10 +153,10 @@ dependencies:
142
153
  version: '0'
143
154
  type: :runtime
144
155
  prerelease: false
145
- version_requirements: *23385220
156
+ version_requirements: *12240920
146
157
  - !ruby/object:Gem::Dependency
147
158
  name: sass-rails
148
- requirement: &23384800 !ruby/object:Gem::Requirement
159
+ requirement: &12215580 !ruby/object:Gem::Requirement
149
160
  none: false
150
161
  requirements:
151
162
  - - ! '>='
@@ -153,10 +164,10 @@ dependencies:
153
164
  version: '0'
154
165
  type: :runtime
155
166
  prerelease: false
156
- version_requirements: *23384800
167
+ version_requirements: *12215580
157
168
  - !ruby/object:Gem::Dependency
158
169
  name: sso_client
159
- requirement: &23384380 !ruby/object:Gem::Requirement
170
+ requirement: &12215160 !ruby/object:Gem::Requirement
160
171
  none: false
161
172
  requirements:
162
173
  - - ! '>='
@@ -164,10 +175,10 @@ dependencies:
164
175
  version: '0'
165
176
  type: :runtime
166
177
  prerelease: false
167
- version_requirements: *23384380
178
+ version_requirements: *12215160
168
179
  - !ruby/object:Gem::Dependency
169
180
  name: spork
170
- requirement: &23383880 !ruby/object:Gem::Requirement
181
+ requirement: &12214660 !ruby/object:Gem::Requirement
171
182
  none: false
172
183
  requirements:
173
184
  - - ! '>='
@@ -175,10 +186,10 @@ dependencies:
175
186
  version: 0.9.0.rc9
176
187
  type: :runtime
177
188
  prerelease: false
178
- version_requirements: *23383880
189
+ version_requirements: *12214660
179
190
  - !ruby/object:Gem::Dependency
180
191
  name: sunspot_rails
181
- requirement: &23383460 !ruby/object:Gem::Requirement
192
+ requirement: &12214240 !ruby/object:Gem::Requirement
182
193
  none: false
183
194
  requirements:
184
195
  - - ! '>='
@@ -186,10 +197,10 @@ dependencies:
186
197
  version: '0'
187
198
  type: :runtime
188
199
  prerelease: false
189
- version_requirements: *23383460
200
+ version_requirements: *12214240
190
201
  - !ruby/object:Gem::Dependency
191
202
  name: whenever
192
- requirement: &23383000 !ruby/object:Gem::Requirement
203
+ requirement: &12213780 !ruby/object:Gem::Requirement
193
204
  none: false
194
205
  requirements:
195
206
  - - ! '>='
@@ -197,10 +208,10 @@ dependencies:
197
208
  version: '0'
198
209
  type: :runtime
199
210
  prerelease: false
200
- version_requirements: *23383000
211
+ version_requirements: *12213780
201
212
  - !ruby/object:Gem::Dependency
202
213
  name: rspec-rails
203
- requirement: &23382380 !ruby/object:Gem::Requirement
214
+ requirement: &12213360 !ruby/object:Gem::Requirement
204
215
  none: false
205
216
  requirements:
206
217
  - - ! '>='
@@ -208,10 +219,10 @@ dependencies:
208
219
  version: '0'
209
220
  type: :development
210
221
  prerelease: false
211
- version_requirements: *23382380
222
+ version_requirements: *12213360
212
223
  - !ruby/object:Gem::Dependency
213
224
  name: guard
214
- requirement: &23381920 !ruby/object:Gem::Requirement
225
+ requirement: &12212940 !ruby/object:Gem::Requirement
215
226
  none: false
216
227
  requirements:
217
228
  - - ! '>='
@@ -219,10 +230,10 @@ dependencies:
219
230
  version: '0'
220
231
  type: :development
221
232
  prerelease: false
222
- version_requirements: *23381920
233
+ version_requirements: *12212940
223
234
  - !ruby/object:Gem::Dependency
224
235
  name: guard-spork
225
- requirement: &23381400 !ruby/object:Gem::Requirement
236
+ requirement: &12212520 !ruby/object:Gem::Requirement
226
237
  none: false
227
238
  requirements:
228
239
  - - ! '>='
@@ -230,10 +241,10 @@ dependencies:
230
241
  version: '0'
231
242
  type: :development
232
243
  prerelease: false
233
- version_requirements: *23381400
244
+ version_requirements: *12212520
234
245
  - !ruby/object:Gem::Dependency
235
246
  name: guard-rspec
236
- requirement: &23363240 !ruby/object:Gem::Requirement
247
+ requirement: &12212100 !ruby/object:Gem::Requirement
237
248
  none: false
238
249
  requirements:
239
250
  - - ! '>='
@@ -241,10 +252,10 @@ dependencies:
241
252
  version: '0'
242
253
  type: :development
243
254
  prerelease: false
244
- version_requirements: *23363240
255
+ version_requirements: *12212100
245
256
  - !ruby/object:Gem::Dependency
246
257
  name: sqlite3
247
- requirement: &23362820 !ruby/object:Gem::Requirement
258
+ requirement: &12211680 !ruby/object:Gem::Requirement
248
259
  none: false
249
260
  requirements:
250
261
  - - ! '>='
@@ -252,10 +263,10 @@ dependencies:
252
263
  version: '0'
253
264
  type: :development
254
265
  prerelease: false
255
- version_requirements: *23362820
266
+ version_requirements: *12211680
256
267
  - !ruby/object:Gem::Dependency
257
268
  name: sunspot_solr
258
- requirement: &23362400 !ruby/object:Gem::Requirement
269
+ requirement: &12211260 !ruby/object:Gem::Requirement
259
270
  none: false
260
271
  requirements:
261
272
  - - ! '>='
@@ -263,10 +274,10 @@ dependencies:
263
274
  version: '0'
264
275
  type: :development
265
276
  prerelease: false
266
- version_requirements: *23362400
277
+ version_requirements: *12211260
267
278
  - !ruby/object:Gem::Dependency
268
279
  name: shoulda-matchers
269
- requirement: &23361980 !ruby/object:Gem::Requirement
280
+ requirement: &12210840 !ruby/object:Gem::Requirement
270
281
  none: false
271
282
  requirements:
272
283
  - - ! '>='
@@ -274,10 +285,10 @@ dependencies:
274
285
  version: '0'
275
286
  type: :development
276
287
  prerelease: false
277
- version_requirements: *23361980
288
+ version_requirements: *12210840
278
289
  - !ruby/object:Gem::Dependency
279
290
  name: forgery
280
- requirement: &23361540 !ruby/object:Gem::Requirement
291
+ requirement: &12210420 !ruby/object:Gem::Requirement
281
292
  none: false
282
293
  requirements:
283
294
  - - ! '>='
@@ -285,10 +296,10 @@ dependencies:
285
296
  version: '0'
286
297
  type: :development
287
298
  prerelease: false
288
- version_requirements: *23361540
299
+ version_requirements: *12210420
289
300
  - !ruby/object:Gem::Dependency
290
301
  name: ryba
291
- requirement: &23361080 !ruby/object:Gem::Requirement
302
+ requirement: &12210000 !ruby/object:Gem::Requirement
292
303
  none: false
293
304
  requirements:
294
305
  - - ! '>='
@@ -296,10 +307,10 @@ dependencies:
296
307
  version: '0'
297
308
  type: :development
298
309
  prerelease: false
299
- version_requirements: *23361080
310
+ version_requirements: *12210000
300
311
  - !ruby/object:Gem::Dependency
301
312
  name: fabrication
302
- requirement: &23360620 !ruby/object:Gem::Requirement
313
+ requirement: &12209580 !ruby/object:Gem::Requirement
303
314
  none: false
304
315
  requirements:
305
316
  - - ! '>='
@@ -307,10 +318,10 @@ dependencies:
307
318
  version: '0'
308
319
  type: :development
309
320
  prerelease: false
310
- version_requirements: *23360620
321
+ version_requirements: *12209580
311
322
  - !ruby/object:Gem::Dependency
312
323
  name: therubyracer
313
- requirement: &23360180 !ruby/object:Gem::Requirement
324
+ requirement: &12209160 !ruby/object:Gem::Requirement
314
325
  none: false
315
326
  requirements:
316
327
  - - ! '>='
@@ -318,10 +329,10 @@ dependencies:
318
329
  version: '0'
319
330
  type: :development
320
331
  prerelease: false
321
- version_requirements: *23360180
332
+ version_requirements: *12209160
322
333
  - !ruby/object:Gem::Dependency
323
334
  name: uglifier
324
- requirement: &23359760 !ruby/object:Gem::Requirement
335
+ requirement: &12208740 !ruby/object:Gem::Requirement
325
336
  none: false
326
337
  requirements:
327
338
  - - ! '>='
@@ -329,7 +340,7 @@ dependencies:
329
340
  version: '0'
330
341
  type: :development
331
342
  prerelease: false
332
- version_requirements: *23359760
343
+ version_requirements: *12208740
333
344
  description: Description of EspPermissions.
334
345
  email:
335
346
  - mail@openteam.ru
@@ -365,6 +376,7 @@ files:
365
376
  - lib/generators/esp_permissions/install/templates/config/schedule.rb
366
377
  - lib/generators/esp_permissions/install/templates/db/migrate/esp_permissions_create_permissions.rb
367
378
  - lib/generators/esp_permissions/install/templates/db/migrate/esp_permissions_create_contexts.rb
379
+ - lib/generators/esp_permissions/install/templates/db/migrate/esp_permissions_add_permissions_count_to_users.rb
368
380
  - lib/esp-permissions/engine.rb
369
381
  - lib/esp-permissions/version.rb
370
382
  - lib/tasks/esp-permissions_tasks.rake
@@ -386,7 +398,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
386
398
  version: '0'
387
399
  segments:
388
400
  - 0
389
- hash: -3009214921157908264
401
+ hash: -1237247969969571249
390
402
  required_rubygems_version: !ruby/object:Gem::Requirement
391
403
  none: false
392
404
  requirements:
@@ -395,7 +407,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
395
407
  version: '0'
396
408
  segments:
397
409
  - 0
398
- hash: -3009214921157908264
410
+ hash: -1237247969969571249
399
411
  requirements: []
400
412
  rubyforge_project:
401
413
  rubygems_version: 1.8.10