authority 2.4.1 → 2.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.markdown +4 -0
- data/lib/authority/controller.rb +1 -3
- data/lib/authority/version.rb +1 -1
- data/spec/authority/controller_spec.rb +25 -0
- metadata +4 -4
data/CHANGELOG.markdown
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
Authority does its best to use [semantic versioning](http://semver.org).
|
4
4
|
|
5
|
+
## v2.4.2
|
6
|
+
|
7
|
+
Bugfix - make `authority_resource` inheritable. For instance, if you call `authorize_actions_for Llama` in one controller, a child controller does the same unless told otherwise.
|
8
|
+
|
5
9
|
## v2.4.1
|
6
10
|
|
7
11
|
The controller method name given to `authorize_actions_for` no longer has to be public. (We don't want to force controllers to make any method public that shouldn't be a routable action.)
|
data/lib/authority/controller.rb
CHANGED
@@ -14,9 +14,7 @@ module Authority
|
|
14
14
|
|
15
15
|
included do
|
16
16
|
rescue_from(Authority::SecurityViolation, :with => Authority::Controller.security_violation_callback)
|
17
|
-
|
18
|
-
attr_accessor :authority_resource
|
19
|
-
end
|
17
|
+
class_attribute :authority_resource, instance_reader: false
|
20
18
|
end
|
21
19
|
|
22
20
|
module ClassMethods
|
data/lib/authority/version.rb
CHANGED
@@ -112,6 +112,31 @@ describe Authority::Controller do
|
|
112
112
|
|
113
113
|
end
|
114
114
|
|
115
|
+
describe "authority_resource" do
|
116
|
+
|
117
|
+
let(:child_controller) { Class.new(controller_class) }
|
118
|
+
|
119
|
+
before :each do
|
120
|
+
controller_class.authorize_actions_for(resource_class)
|
121
|
+
end
|
122
|
+
|
123
|
+
it "remembers what it was set to" do
|
124
|
+
expect(controller_class.authority_resource).to eq(resource_class)
|
125
|
+
end
|
126
|
+
|
127
|
+
it "uses its parent controller's value by default" do
|
128
|
+
expect(child_controller.authority_resource).to eq(resource_class)
|
129
|
+
end
|
130
|
+
|
131
|
+
it "can be modified without affecting the parent controller" do
|
132
|
+
fancy_array = Class.new(Array)
|
133
|
+
child_controller.authorize_actions_for(fancy_array)
|
134
|
+
expect(child_controller.authority_resource).to eq(fancy_array)
|
135
|
+
expect(controller_class.authority_resource).to eq(resource_class)
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
|
115
140
|
describe "authority_action" do
|
116
141
|
|
117
142
|
it "modifies this controller's authority action map" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: authority
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-02-
|
13
|
+
date: 2013-02-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -89,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
89
|
version: '0'
|
90
90
|
segments:
|
91
91
|
- 0
|
92
|
-
hash:
|
92
|
+
hash: 3595065084412146682
|
93
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
98
|
version: '0'
|
99
99
|
segments:
|
100
100
|
- 0
|
101
|
-
hash:
|
101
|
+
hash: 3595065084412146682
|
102
102
|
requirements: []
|
103
103
|
rubyforge_project:
|
104
104
|
rubygems_version: 1.8.24
|