ae_declarative_authorization 0.6.0.pre2 → 0.6.0.pre3
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b32026106200839d7c0b87b1b00ce72bc8656bf
|
4
|
+
data.tar.gz: 002a81249ed4976c82902fe1c9c74996d70a1f11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db6eeaadd8ed3967feb98022e667bc38210d5438277d7f2c032651b579dc661d44a0478df130983ec8865643d971024b20280e3c22709966c8c50d7298efa855
|
7
|
+
data.tar.gz: a25e17d7c478f5df03a9f8f2bcabe8f1cec181fe87ebd6eaa9629fbe0ad48e723d5df19f03029607a108d083787c107f140787f7b3a4b2b1650242c6902b0ce8
|
Binary file
|
@@ -60,7 +60,7 @@ module DeclarativeAuthorization
|
|
60
60
|
privileges = @privileges
|
61
61
|
|
62
62
|
actions = options[:to]
|
63
|
-
raise
|
63
|
+
raise ':to is a required option!' unless actions
|
64
64
|
|
65
65
|
actions = [actions] unless actions.is_a?(Array)
|
66
66
|
params_name = options[:with]
|
@@ -127,10 +127,14 @@ module DeclarativeAuthorization
|
|
127
127
|
module ClassMethods
|
128
128
|
attr_reader :access_tests_defined
|
129
129
|
|
130
|
+
def skip_access_tests_for_actions(*actions)
|
131
|
+
@skipped_access_test_actions ||= []
|
132
|
+
@skipped_access_test_actions += actions.map(&:to_sym)
|
133
|
+
end
|
134
|
+
|
130
135
|
def access_tests(&block)
|
131
136
|
@access_tests_defined = true
|
132
|
-
|
133
|
-
file_output ||= [ 'test/profiles/access_checking', ENV['TEST_ENV_NUMBER'] ].compact.join(".")
|
137
|
+
file_output ||= [ 'test/profiles/access_checking', ENV['TEST_ENV_NUMBER'] ].compact.join('.')
|
134
138
|
unless File.exists?(file_output)
|
135
139
|
FileUtils.mkdir_p(File.dirname(file_output))
|
136
140
|
end
|
@@ -151,18 +155,22 @@ module DeclarativeAuthorization
|
|
151
155
|
alias :access_tests_not_required :this_is_an_abstract_controller_so_it_needs_no_access_tests
|
152
156
|
|
153
157
|
def all_public_actions
|
154
|
-
actions = controller_class.public_instance_methods(false)
|
155
|
-
actions += controller_class.superclass.public_instance_methods(false)
|
156
|
-
actions.reject!
|
158
|
+
actions = controller_class.public_instance_methods(false)
|
159
|
+
actions += controller_class.superclass.public_instance_methods(false)
|
160
|
+
actions.reject! do |method|
|
161
|
+
method =~ /^_/ ||
|
162
|
+
method =~ /^rescue_action/ ||
|
163
|
+
(@skipped_access_test_actions.is_a?(Array) && @skipped_access_test_actions.include?(method))
|
164
|
+
end
|
157
165
|
|
158
|
-
actions.uniq
|
166
|
+
actions.uniq
|
159
167
|
end
|
160
168
|
|
161
169
|
def inherited(child)
|
162
170
|
super
|
163
171
|
|
164
172
|
child.send(:define_method, :test_access_tests_defined) do
|
165
|
-
assert self.class.access_tests_defined,
|
173
|
+
assert self.class.access_tests_defined, 'Access tests needed but not defined.'
|
166
174
|
end
|
167
175
|
|
168
176
|
child.send(:define_method, :test_all_public_actions_covered_by_role_tests) do
|
@@ -183,7 +191,7 @@ module DeclarativeAuthorization
|
|
183
191
|
protected
|
184
192
|
|
185
193
|
def response_forbidden?
|
186
|
-
flash[:error] ==
|
194
|
+
flash[:error] == 'You do not have the correct permissions to access that page. Click the back button to return to your previous page.' ||
|
187
195
|
flash[:error] =~ /You do not have the correct permissions to view this/ ||
|
188
196
|
flash[:error] =~ /You do not have access to/ ||
|
189
197
|
flash[:alert] =~ /You need to sign in/ ||
|
@@ -211,7 +219,7 @@ module DeclarativeAuthorization
|
|
211
219
|
end
|
212
220
|
|
213
221
|
def access_test_user(role, privilege)
|
214
|
-
raise
|
222
|
+
raise 'MUST IMPLEMENT!!!'
|
215
223
|
end
|
216
224
|
|
217
225
|
def forbidden_with_role_and_privilege?(action, role, privilege, params_name = nil, options = {})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ae_declarative_authorization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.0.
|
4
|
+
version: 0.6.0.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AppFolio
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-06-
|
12
|
+
date: 2018-06-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: blockenspiel
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- README.md
|
61
61
|
- README.rdoc
|
62
62
|
- Rakefile
|
63
|
+
- ae_declarative_authorization-0.6.0.pre2.gem
|
63
64
|
- authorization_rules.dist.rb
|
64
65
|
- declarative_authorization.gemspec
|
65
66
|
- gemfiles/4.1.gemfile.lock
|