simon_says 0.3.0.alpha.4 → 0.3.0.alpha.5
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 +4 -4
- data/lib/simon_says/authorizer.rb +12 -2
- data/lib/simon_says/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3abfdc67fe4a00391a5a167d425db7cda7e855c316b00a724d1f452114af6c68
|
4
|
+
data.tar.gz: c14a9de36943db2c6059b8ea6a41063ad99a704a0964c38600a99ebb3687a170
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac1930289951138e3bee481d6f09a44b3f5b3878e4b19685167614add7ceff33e1ebb409ec67f382dd3985ba9970373ff3ddac316b97b82443c383d16bc3a7b6
|
7
|
+
data.tar.gz: 9be3fd968195386735821c2ab17b02ce59de685788ad54cc5ded492368e6c2bc2e92f36f77a4b61c1924a78d052ca7b1d0283770957ed8702651f89968839108
|
@@ -6,7 +6,9 @@ module SimonSays
|
|
6
6
|
# @private
|
7
7
|
def initialize(as, required, actual)
|
8
8
|
# TODO i18n for err message (as should be singluarized with 1 flag)
|
9
|
-
|
9
|
+
current_access = actual.empty? ? 'empty' : actual.join(', ')
|
10
|
+
|
11
|
+
super "Access denied; #{required * ', '} #{as} is required. Current access is #{current_access}"
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
@@ -145,7 +147,8 @@ module SimonSays
|
|
145
147
|
scope, query = resource_scope_and_query(resource, options)
|
146
148
|
through = options[:through] ? options[:through].to_s : nil
|
147
149
|
|
148
|
-
|
150
|
+
assoc_name = through || (options[:from] ? resource.pluralize : nil)
|
151
|
+
assoc = Authorizer.association_method(assoc_name)
|
149
152
|
scope = scope.send(assoc) if assoc && scope.respond_to?(assoc)
|
150
153
|
|
151
154
|
record = scope.where(query).first!
|
@@ -195,6 +198,13 @@ module SimonSays
|
|
195
198
|
end
|
196
199
|
end
|
197
200
|
|
201
|
+
def self.association_method(assoc)
|
202
|
+
return if assoc.nil?
|
203
|
+
return :"#{assoc}_dataset" if defined? Sequel
|
204
|
+
|
205
|
+
assoc.to_sym
|
206
|
+
end
|
207
|
+
|
198
208
|
private
|
199
209
|
|
200
210
|
# @private
|
data/lib/simon_says/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simon_says
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.0.alpha.
|
4
|
+
version: 0.3.0.alpha.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Coyne
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2019-07-
|
13
|
+
date: 2019-07-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|