cantango 0.9.3.2 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. data/README.textile +11 -9
  2. data/VERSION +1 -1
  3. data/cantango.gemspec +24 -3
  4. data/lib/cantango/ability/cache/key.rb +6 -2
  5. data/lib/cantango/ability/cache/reader.rb +3 -0
  6. data/lib/cantango/ability/cache/session_cache.rb +7 -3
  7. data/lib/cantango/ability/cache/writer.rb +8 -2
  8. data/lib/cantango/ability/cache.rb +25 -8
  9. data/lib/cantango/ability/cache_helpers.rb +4 -13
  10. data/lib/cantango/ability/cached_executor.rb +0 -0
  11. data/lib/cantango/ability/engine_helpers.rb +4 -1
  12. data/lib/cantango/ability/executor.rb +67 -0
  13. data/lib/cantango/ability/permission_helpers.rb +0 -1
  14. data/lib/cantango/ability.rb +1 -1
  15. data/lib/cantango/cached_ability.rb +3 -2
  16. data/lib/cantango/configuration/engines/cache.rb +0 -3
  17. data/lib/cantango/configuration/engines/engine.rb +5 -0
  18. data/lib/cantango/configuration/engines/permission.rb +5 -4
  19. data/lib/cantango/configuration/engines/permit.rb +0 -5
  20. data/lib/cantango/configuration/engines/user_ac.rb +6 -3
  21. data/lib/cantango/configuration/models/active_record.rb +11 -0
  22. data/lib/cantango/configuration/models/data_mapper.rb +12 -0
  23. data/lib/cantango/configuration/models/generic.rb +12 -0
  24. data/lib/cantango/configuration/models/mongo.rb +12 -0
  25. data/lib/cantango/configuration/models/mongo_mapper.rb +11 -0
  26. data/lib/cantango/configuration/models/mongoid.rb +13 -0
  27. data/lib/cantango/configuration/models.rb +27 -2
  28. data/lib/cantango/configuration/permits.rb +2 -1
  29. data/lib/cantango/configuration.rb +14 -0
  30. data/lib/cantango/engine.rb +5 -19
  31. data/lib/cantango/model/scope.rb +19 -5
  32. data/lib/cantango/permission_engine/collector.rb +3 -0
  33. data/lib/cantango/permission_engine/evaluator.rb +5 -0
  34. data/lib/cantango/permission_engine/factory.rb +3 -0
  35. data/lib/cantango/permission_engine/loader/permissions.rb +7 -8
  36. data/lib/cantango/permission_engine/store.rb +0 -1
  37. data/lib/cantango/permission_engine/yaml_store.rb +15 -4
  38. data/lib/cantango/permission_engine.rb +21 -4
  39. data/lib/cantango/permit_engine/factory.rb +10 -4
  40. data/lib/cantango/permit_engine.rb +39 -9
  41. data/lib/cantango/permits/account_permit/builder.rb +6 -2
  42. data/lib/cantango/{user_ac_engine → permits}/executor.rb +28 -30
  43. data/lib/cantango/permits/permit/class_methods.rb +21 -0
  44. data/lib/cantango/permits/permit/execute.rb +81 -0
  45. data/lib/cantango/permits/permit/license.rb +26 -0
  46. data/lib/cantango/permits/permit.rb +19 -138
  47. data/lib/cantango/permits/role_group_permit/builder.rb +5 -1
  48. data/lib/cantango/permits/role_group_permit.rb +3 -3
  49. data/lib/cantango/permits/role_permit/builder.rb +4 -0
  50. data/lib/cantango/permits/user_permit/builder.rb +5 -1
  51. data/lib/cantango/permits/user_permit.rb +1 -1
  52. data/lib/cantango/permits.rb +1 -0
  53. data/lib/cantango/rails/engine.rb +0 -3
  54. data/lib/cantango/rails/helpers/base_helper.rb +1 -1
  55. data/lib/cantango/rails/helpers/rest_helper.rb +1 -1
  56. data/lib/cantango/rules/adaptor/active_record.rb +1 -4
  57. data/lib/cantango/rules/adaptor/data_mapper.rb +11 -0
  58. data/lib/cantango/rules/adaptor/mongo.rb +19 -0
  59. data/lib/cantango/rules/adaptor/mongo_mapper.rb +10 -0
  60. data/lib/cantango/rules/adaptor/mongoid.rb +1 -5
  61. data/lib/cantango/rules/adaptor/relational.rb +13 -0
  62. data/lib/cantango/rules/adaptor.rb +12 -7
  63. data/lib/cantango/rules/user_relation.rb +1 -2
  64. data/lib/cantango/user_ac_engine.rb +25 -7
  65. data/lib/cantango.rb +2 -0
  66. data/spec/cantango/ability/executor_spec.rb +67 -0
  67. data/spec/cantango/ability_executor/cached_only_spec.rb +1 -0
  68. data/spec/cantango/model/scope_spec.rb +11 -0
  69. data/spec/cantango/models/items.rb +5 -0
  70. data/spec/cantango/permission_engine_cached_spec.rb +51 -0
  71. data/spec/cantango/permission_engine_spec.rb +55 -0
  72. data/spec/cantango/permit_engine_cached_spec.rb +56 -0
  73. data/spec/cantango/permit_engine_spec.rb +57 -1
  74. data/spec/cantango/permits/executor_cached_spec.rb +0 -0
  75. data/spec/cantango/permits/executor_spec.rb +68 -0
  76. data/spec/cantango/user_ac_engine_cached_spec.rb +64 -0
  77. data/spec/cantango/user_ac_engine_spec.rb +14 -2
  78. data/spec/fixtures/models/items.rb +3 -0
  79. data/spec/fixtures/models/user.rb +18 -0
  80. metadata +55 -34
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cantango
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3.2
4
+ version: 0.9.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2011-10-29 00:00:00.000000000Z
13
+ date: 2011-11-02 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
17
- requirement: &70260734920200 !ruby/object:Gem::Requirement
17
+ requirement: &70161262243140 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: 3.0.1
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70260734920200
25
+ version_requirements: *70161262243140
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: cancan
28
- requirement: &70260734919700 !ruby/object:Gem::Requirement
28
+ requirement: &70161262240600 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ! '>='
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: '1.4'
34
34
  type: :runtime
35
35
  prerelease: false
36
- version_requirements: *70260734919700
36
+ version_requirements: *70161262240600
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: sugar-high
39
- requirement: &70260734919140 !ruby/object:Gem::Requirement
39
+ requirement: &70161262227520 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: 0.6.0
45
45
  type: :runtime
46
46
  prerelease: false
47
- version_requirements: *70260734919140
47
+ version_requirements: *70161262227520
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: sweetloader
50
- requirement: &70260734918400 !ruby/object:Gem::Requirement
50
+ requirement: &70161262225460 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ~>
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: 0.1.0
56
56
  type: :runtime
57
57
  prerelease: false
58
- version_requirements: *70260734918400
58
+ version_requirements: *70161262225460
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: hashie
61
- requirement: &70260734917620 !ruby/object:Gem::Requirement
61
+ requirement: &70161262223580 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0.4'
67
67
  type: :runtime
68
68
  prerelease: false
69
- version_requirements: *70260734917620
69
+ version_requirements: *70161262223580
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: rspec-rails
72
- requirement: &70260734916760 !ruby/object:Gem::Requirement
72
+ requirement: &70161262222320 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,10 +77,10 @@ dependencies:
77
77
  version: 2.6.1
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *70260734916760
80
+ version_requirements: *70161262222320
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: forgery
83
- requirement: &70260734916020 !ruby/object:Gem::Requirement
83
+ requirement: &70161262221380 !ruby/object:Gem::Requirement
84
84
  none: false
85
85
  requirements:
86
86
  - - ! '>='
@@ -88,10 +88,10 @@ dependencies:
88
88
  version: '0.3'
89
89
  type: :development
90
90
  prerelease: false
91
- version_requirements: *70260734916020
91
+ version_requirements: *70161262221380
92
92
  - !ruby/object:Gem::Dependency
93
93
  name: factory_girl
94
- requirement: &70260734915520 !ruby/object:Gem::Requirement
94
+ requirement: &70161262217760 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ! '>='
@@ -99,10 +99,10 @@ dependencies:
99
99
  version: '0'
100
100
  type: :development
101
101
  prerelease: false
102
- version_requirements: *70260734915520
102
+ version_requirements: *70161262217760
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: sqlite3
105
- requirement: &70260734914840 !ruby/object:Gem::Requirement
105
+ requirement: &70161262216800 !ruby/object:Gem::Requirement
106
106
  none: false
107
107
  requirements:
108
108
  - - ! '>='
@@ -110,10 +110,10 @@ dependencies:
110
110
  version: '0'
111
111
  type: :development
112
112
  prerelease: false
113
- version_requirements: *70260734914840
113
+ version_requirements: *70161262216800
114
114
  - !ruby/object:Gem::Dependency
115
115
  name: sourcify
116
- requirement: &70260734914360 !ruby/object:Gem::Requirement
116
+ requirement: &70161262215960 !ruby/object:Gem::Requirement
117
117
  none: false
118
118
  requirements:
119
119
  - - ! '>='
@@ -121,10 +121,10 @@ dependencies:
121
121
  version: '0'
122
122
  type: :development
123
123
  prerelease: false
124
- version_requirements: *70260734914360
124
+ version_requirements: *70161262215960
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: dkastner-moneta
127
- requirement: &70260734913880 !ruby/object:Gem::Requirement
127
+ requirement: &70161262215060 !ruby/object:Gem::Requirement
128
128
  none: false
129
129
  requirements:
130
130
  - - ! '>='
@@ -132,10 +132,10 @@ dependencies:
132
132
  version: '1.0'
133
133
  type: :development
134
134
  prerelease: false
135
- version_requirements: *70260734913880
135
+ version_requirements: *70161262215060
136
136
  - !ruby/object:Gem::Dependency
137
137
  name: rspec
138
- requirement: &70260734913400 !ruby/object:Gem::Requirement
138
+ requirement: &70161262213820 !ruby/object:Gem::Requirement
139
139
  none: false
140
140
  requirements:
141
141
  - - ! '>='
@@ -143,10 +143,10 @@ dependencies:
143
143
  version: 2.4.0
144
144
  type: :development
145
145
  prerelease: false
146
- version_requirements: *70260734913400
146
+ version_requirements: *70161262213820
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: jeweler
149
- requirement: &70260734912920 !ruby/object:Gem::Requirement
149
+ requirement: &70161262212580 !ruby/object:Gem::Requirement
150
150
  none: false
151
151
  requirements:
152
152
  - - ! '>='
@@ -154,10 +154,10 @@ dependencies:
154
154
  version: 1.6.4
155
155
  type: :development
156
156
  prerelease: false
157
- version_requirements: *70260734912920
157
+ version_requirements: *70161262212580
158
158
  - !ruby/object:Gem::Dependency
159
159
  name: bundler
160
- requirement: &70260734912420 !ruby/object:Gem::Requirement
160
+ requirement: &70161262211160 !ruby/object:Gem::Requirement
161
161
  none: false
162
162
  requirements:
163
163
  - - ! '>='
@@ -165,10 +165,10 @@ dependencies:
165
165
  version: 1.0.1
166
166
  type: :development
167
167
  prerelease: false
168
- version_requirements: *70260734912420
168
+ version_requirements: *70161262211160
169
169
  - !ruby/object:Gem::Dependency
170
170
  name: rdoc
171
- requirement: &70260734911940 !ruby/object:Gem::Requirement
171
+ requirement: &70161262206720 !ruby/object:Gem::Requirement
172
172
  none: false
173
173
  requirements:
174
174
  - - ! '>='
@@ -176,7 +176,7 @@ dependencies:
176
176
  version: '0'
177
177
  type: :development
178
178
  prerelease: false
179
- version_requirements: *70260734911940
179
+ version_requirements: *70161262206720
180
180
  description: ! 'Define your permission rules as role- or role group specific permits.
181
181
 
182
182
  Integrates well with multiple Devise user acounts.
@@ -212,7 +212,9 @@ files:
212
212
  - lib/cantango/ability/cache/session_cache.rb
213
213
  - lib/cantango/ability/cache/writer.rb
214
214
  - lib/cantango/ability/cache_helpers.rb
215
+ - lib/cantango/ability/cached_executor.rb
215
216
  - lib/cantango/ability/engine_helpers.rb
217
+ - lib/cantango/ability/executor.rb
216
218
  - lib/cantango/ability/masquerade_helpers.rb
217
219
  - lib/cantango/ability/permission_helpers.rb
218
220
  - lib/cantango/ability/permit_helpers.rb
@@ -260,6 +262,12 @@ files:
260
262
  - lib/cantango/configuration/guest.rb
261
263
  - lib/cantango/configuration/hash_registry.rb
262
264
  - lib/cantango/configuration/models.rb
265
+ - lib/cantango/configuration/models/active_record.rb
266
+ - lib/cantango/configuration/models/data_mapper.rb
267
+ - lib/cantango/configuration/models/generic.rb
268
+ - lib/cantango/configuration/models/mongo.rb
269
+ - lib/cantango/configuration/models/mongo_mapper.rb
270
+ - lib/cantango/configuration/models/mongoid.rb
263
271
  - lib/cantango/configuration/modes.rb
264
272
  - lib/cantango/configuration/permit_registry.rb
265
273
  - lib/cantango/configuration/permits.rb
@@ -331,11 +339,15 @@ files:
331
339
  - lib/cantango/permits/account_permit.rb
332
340
  - lib/cantango/permits/account_permit/builder.rb
333
341
  - lib/cantango/permits/account_permit/finder.rb
342
+ - lib/cantango/permits/executor.rb
334
343
  - lib/cantango/permits/license.rb
335
344
  - lib/cantango/permits/license/loader.rb
336
345
  - lib/cantango/permits/license/rules.rb
337
346
  - lib/cantango/permits/macros.rb
338
347
  - lib/cantango/permits/permit.rb
348
+ - lib/cantango/permits/permit/class_methods.rb
349
+ - lib/cantango/permits/permit/execute.rb
350
+ - lib/cantango/permits/permit/license.rb
339
351
  - lib/cantango/permits/role_group_permit.rb
340
352
  - lib/cantango/permits/role_group_permit/builder.rb
341
353
  - lib/cantango/permits/role_group_permit/finder.rb
@@ -362,14 +374,17 @@ files:
362
374
  - lib/cantango/rules.rb
363
375
  - lib/cantango/rules/adaptor.rb
364
376
  - lib/cantango/rules/adaptor/active_record.rb
377
+ - lib/cantango/rules/adaptor/data_mapper.rb
365
378
  - lib/cantango/rules/adaptor/generic.rb
379
+ - lib/cantango/rules/adaptor/mongo.rb
380
+ - lib/cantango/rules/adaptor/mongo_mapper.rb
366
381
  - lib/cantango/rules/adaptor/mongoid.rb
382
+ - lib/cantango/rules/adaptor/relational.rb
367
383
  - lib/cantango/rules/dsl.rb
368
384
  - lib/cantango/rules/rule_class.rb
369
385
  - lib/cantango/rules/scope.rb
370
386
  - lib/cantango/rules/user_relation.rb
371
387
  - lib/cantango/user_ac_engine.rb
372
- - lib/cantango/user_ac_engine/executor.rb
373
388
  - lib/cantango/users.rb
374
389
  - lib/cantango/users/macros.rb
375
390
  - lib/cantango/users/masquerade.rb
@@ -470,6 +485,7 @@ files:
470
485
  - spec/cantango/ability/cache/session_cache_spec.rb
471
486
  - spec/cantango/ability/cache/writer_spec.rb
472
487
  - spec/cantango/ability/cache_spec.rb
488
+ - spec/cantango/ability/executor_spec.rb
473
489
  - spec/cantango/ability_executor/cached_only_spec.rb
474
490
  - spec/cantango/ability_executor_spec.rb
475
491
  - spec/cantango/ability_filters_spec.rb
@@ -536,6 +552,7 @@ files:
536
552
  - spec/cantango/permission_engine/store_spec.rb
537
553
  - spec/cantango/permission_engine/user_permission_store_spec.rb
538
554
  - spec/cantango/permission_engine/yaml_store_spec.rb
555
+ - spec/cantango/permission_engine_cached_spec.rb
539
556
  - spec/cantango/permission_engine_spec.rb
540
557
  - spec/cantango/permit_engine/account_permit_spec.rb
541
558
  - spec/cantango/permit_engine/builder/role_group_permits_spec.rb
@@ -549,10 +566,14 @@ files:
549
566
  - spec/cantango/permit_engine/role_group_permit_spec.rb
550
567
  - spec/cantango/permit_engine/role_permit_spec.rb
551
568
  - spec/cantango/permit_engine/user_permit_spec.rb
569
+ - spec/cantango/permit_engine_cached_spec.rb
552
570
  - spec/cantango/permit_engine_spec.rb
571
+ - spec/cantango/permits/executor_cached_spec.rb
572
+ - spec/cantango/permits/executor_spec.rb
553
573
  - spec/cantango/permits/macros_spec.rb
554
574
  - spec/cantango/permits/permit_spec.rb
555
575
  - spec/cantango/rules_spec.rb
576
+ - spec/cantango/user_ac_engine_cached_spec.rb
556
577
  - spec/cantango/user_ac_engine_spec.rb
557
578
  - spec/cantango_spec.rb
558
579
  - spec/devise-dummy/Rakefile
@@ -847,7 +868,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
847
868
  version: '0'
848
869
  segments:
849
870
  - 0
850
- hash: -2229342728946118666
871
+ hash: -2873936184602189922
851
872
  required_rubygems_version: !ruby/object:Gem::Requirement
852
873
  none: false
853
874
  requirements: