consul 0.10.2 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of consul might be problematic. Click here for more details.

data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  Consul - A next gen authorization solution
2
2
  ==========================================
3
3
 
4
- [![Build Status](https://secure.travis-ci.org/makandra/consul.png?branch=master)](https://travis-ci.org/makandra/consul)
4
+ [![Build Status](https://secure.travis-ci.org/makandra/consul.png?branch=master)](https://travis-ci.org/makandra/consul) [![Code Climate](https://codeclimate.com/github/makandra/consul.png)](https://codeclimate.com/github/makandra/consul)
5
5
 
6
6
  Consul is a authorization solution for Ruby on Rails where you describe *sets of accessible things* to control what a user can see or edit.
7
7
 
@@ -370,8 +370,8 @@ Note that in moderately complex authorization scenarios you will often find your
370
370
 
371
371
  class NotesController < ApplicationController
372
372
  power :notes, :map => {
373
- [:edit, :update] => :updatable_notes
374
- [:new, :create] => :creatable_notes
373
+ [:edit, :update] => :updatable_notes,
374
+ [:new, :create] => :creatable_notes,
375
375
  [:destroy] => :destroyable_notes
376
376
  }
377
377
  end
@@ -700,9 +700,11 @@ A nice shortcut is that when you call `with_power` with an argument that is not
700
700
  # run code that uses Power.current
701
701
  end
702
702
 
703
+ There is also a method `.without_power` that runs a block without a current Power:
703
704
 
704
-
705
-
705
+ Power.without_power do
706
+ # run code that should not see a Power
707
+ end
706
708
 
707
709
 
708
710
  Installation
@@ -79,7 +79,7 @@ module Consul
79
79
  attr_accessor :current
80
80
 
81
81
  def with_power(inner_power, &block)
82
- unless inner_power.is_a?(self)
82
+ unless inner_power.is_a?(self) || inner_power.nil?
83
83
  inner_power = new(inner_power)
84
84
  end
85
85
  old_power = current
@@ -89,6 +89,10 @@ module Consul
89
89
  self.current = old_power
90
90
  end
91
91
 
92
+ def without_power(&block)
93
+ with_power(nil, &block)
94
+ end
95
+
92
96
  def define_query_and_bang_methods(name, &query)
93
97
  query_method = "#{name}?"
94
98
  bang_method = "#{name}!"
@@ -1,3 +1,3 @@
1
1
  module Consul
2
- VERSION = '0.10.2'
2
+ VERSION = '0.11.0'
3
3
  end
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- consul (0.10.1)
4
+ consul (0.11.0)
5
5
  edge_rider
6
6
  memoizer
7
7
  rails
@@ -22,8 +22,8 @@ GEM
22
22
  assignable_values (0.7.1)
23
23
  activerecord
24
24
  columnize (0.3.6)
25
- edge_rider (0.2.1)
26
- rails
25
+ edge_rider (0.2.3)
26
+ activerecord
27
27
  hoe (2.8.0)
28
28
  rake (>= 0.8.7)
29
29
  linecache (0.46)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- consul (0.10.1)
4
+ consul (0.10.2)
5
5
  edge_rider
6
6
  memoizer
7
7
  rails
@@ -44,8 +44,8 @@ GEM
44
44
  builder (2.1.2)
45
45
  columnize (0.3.6)
46
46
  diff-lcs (1.2.4)
47
- edge_rider (0.2.1)
48
- rails
47
+ edge_rider (0.2.3)
48
+ activerecord
49
49
  erubis (2.6.6)
50
50
  abstract (>= 1.0.0)
51
51
  i18n (0.5.0)
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: ../..
3
3
  specs:
4
- consul (0.10.1)
4
+ consul (0.10.2)
5
5
  edge_rider
6
6
  memoizer
7
7
  rails
@@ -44,8 +44,8 @@ GEM
44
44
  builder (3.0.4)
45
45
  columnize (0.3.6)
46
46
  diff-lcs (1.2.4)
47
- edge_rider (0.2.1)
48
- rails
47
+ edge_rider (0.2.3)
48
+ activerecord
49
49
  erubis (2.7.0)
50
50
  hike (1.2.2)
51
51
  i18n (0.6.1)
@@ -495,6 +495,15 @@ describe Consul::Power do
495
495
  end
496
496
  end
497
497
 
498
+ it 'should not instantiate a new Power if the given argument is nil' do
499
+ spy = double
500
+ Power.should_not_receive(:new)
501
+ spy.should_receive(:observe).with(nil)
502
+ Power.with_power(nil) do
503
+ spy.observe(Power.current)
504
+ end
505
+ end
506
+
498
507
  end
499
508
 
500
509
  describe '#for_model' do
metadata CHANGED
@@ -1,70 +1,74 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: consul
3
- version: !ruby/object:Gem::Version
4
- version: 0.10.2
3
+ version: !ruby/object:Gem::Version
4
+ hash: 51
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 11
9
+ - 0
10
+ version: 0.11.0
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Henning Koch
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2013-10-07 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2013-12-18 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
15
22
  name: memoizer
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :runtime
23
23
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
30
- - !ruby/object:Gem::Dependency
31
- name: rails
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
34
- requirements:
35
- - - ! '>='
36
- - !ruby/object:Gem::Version
37
- version: '0'
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
38
33
  type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: rails
39
37
  prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
38
+ requirement: &id002 !ruby/object:Gem::Requirement
41
39
  none: false
42
- requirements:
43
- - - ! '>='
44
- - !ruby/object:Gem::Version
45
- version: '0'
46
- - !ruby/object:Gem::Dependency
47
- name: edge_rider
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
52
- - !ruby/object:Gem::Version
53
- version: '0'
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
54
47
  type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: edge_rider
55
51
  prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
52
+ requirement: &id003 !ruby/object:Gem::Requirement
57
53
  none: false
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :runtime
62
+ version_requirements: *id003
62
63
  description: A scope-based authorization solution for Ruby on Rails.
63
64
  email: henning.koch@makandra.de
64
65
  executables: []
66
+
65
67
  extensions: []
68
+
66
69
  extra_rdoc_files: []
67
- files:
70
+
71
+ files:
68
72
  - .gitignore
69
73
  - .travis.yml
70
74
  - LICENSE
@@ -168,29 +172,39 @@ files:
168
172
  - spec/shared/consul/controllers/users_controller_spec.rb
169
173
  - spec/shared/consul/power_spec.rb
170
174
  - spec/shared/consul/util_spec.rb
175
+ has_rdoc: true
171
176
  homepage: https://github.com/makandra/consul
172
- licenses:
177
+ licenses:
173
178
  - MIT
174
179
  post_install_message:
175
180
  rdoc_options: []
176
- require_paths:
181
+
182
+ require_paths:
177
183
  - lib
178
- required_ruby_version: !ruby/object:Gem::Requirement
184
+ required_ruby_version: !ruby/object:Gem::Requirement
179
185
  none: false
180
- requirements:
181
- - - ! '>='
182
- - !ruby/object:Gem::Version
183
- version: '0'
184
- required_rubygems_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ hash: 3
190
+ segments:
191
+ - 0
192
+ version: "0"
193
+ required_rubygems_version: !ruby/object:Gem::Requirement
185
194
  none: false
186
- requirements:
187
- - - ! '>='
188
- - !ruby/object:Gem::Version
189
- version: '0'
195
+ requirements:
196
+ - - ">="
197
+ - !ruby/object:Gem::Version
198
+ hash: 3
199
+ segments:
200
+ - 0
201
+ version: "0"
190
202
  requirements: []
203
+
191
204
  rubyforge_project:
192
- rubygems_version: 1.8.25
205
+ rubygems_version: 1.3.9.5
193
206
  signing_key:
194
207
  specification_version: 3
195
208
  summary: A scope-based authorization solution for Ruby on Rails.
196
209
  test_files: []
210
+