strong_actions 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -3
- data/Gemfile.lock +24 -41
- data/HISTORY.md +3 -0
- data/lib/strong_actions/config.rb +1 -0
- data/lib/strong_actions/decision.rb +11 -7
- data/lib/strong_actions/version.rb +1 -1
- data/test/decision_test.rb +5 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31fc4f5e9191a56ec48d3f35fdb424deaa0371ae
|
4
|
+
data.tar.gz: 8a4e24d7bb75c0930820a4856b87bfc1f56a6fc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d71a0a3d851fdd2b8e7b95706e4a4040849cf4fca180f1fb11d673bcee0f7c04f88a1072a1391b0a2d77ddf39c7a1003107e5cd87fcb5cce7f88ae7bf1d84615
|
7
|
+
data.tar.gz: de3ee53a2db2ee226297b46a1e7dc1b9f54c6117e6992fb69a0d5266d1b13f8d52b3ba8935b657a69e61077cba2d73db55fdc6f38f5993b3800798f305bef44f
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -9,62 +9,45 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
actionpack (
|
13
|
-
|
14
|
-
activesupport (=
|
15
|
-
|
12
|
+
actionpack (4.1.6)
|
13
|
+
actionview (= 4.1.6)
|
14
|
+
activesupport (= 4.1.6)
|
15
|
+
rack (~> 1.5.2)
|
16
|
+
rack-test (~> 0.6.2)
|
17
|
+
actionview (4.1.6)
|
18
|
+
activesupport (= 4.1.6)
|
19
|
+
builder (~> 3.1)
|
16
20
|
erubis (~> 2.7.0)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
builder (~> 3.0.0)
|
25
|
-
activesupport (3.2.19)
|
26
|
-
i18n (~> 0.6, >= 0.6.4)
|
27
|
-
multi_json (~> 1.0)
|
28
|
-
builder (3.0.4)
|
21
|
+
activesupport (4.1.6)
|
22
|
+
i18n (~> 0.6, >= 0.6.9)
|
23
|
+
json (~> 1.7, >= 1.7.7)
|
24
|
+
minitest (~> 5.1)
|
25
|
+
thread_safe (~> 0.1)
|
26
|
+
tzinfo (~> 1.1)
|
27
|
+
builder (3.2.2)
|
29
28
|
erubis (2.7.0)
|
30
|
-
hike (1.2.3)
|
31
29
|
i18n (0.6.11)
|
32
|
-
journey (1.0.4)
|
33
30
|
json (1.8.1)
|
34
|
-
minitest (5.4.
|
35
|
-
|
36
|
-
rack (1.4.5)
|
37
|
-
rack-cache (1.2)
|
38
|
-
rack (>= 0.4)
|
39
|
-
rack-ssl (1.3.4)
|
40
|
-
rack
|
31
|
+
minitest (5.4.2)
|
32
|
+
rack (1.5.2)
|
41
33
|
rack-test (0.6.2)
|
42
34
|
rack (>= 1.0)
|
43
|
-
railties (
|
44
|
-
actionpack (=
|
45
|
-
activesupport (=
|
46
|
-
rack-ssl (~> 1.3.2)
|
35
|
+
railties (4.1.6)
|
36
|
+
actionpack (= 4.1.6)
|
37
|
+
activesupport (= 4.1.6)
|
47
38
|
rake (>= 0.8.7)
|
48
|
-
|
49
|
-
thor (>= 0.14.6, < 2.0)
|
39
|
+
thor (>= 0.18.1, < 2.0)
|
50
40
|
rake (10.3.2)
|
51
|
-
rdoc (3.12.2)
|
52
|
-
json (~> 1.4)
|
53
|
-
sprockets (2.2.2)
|
54
|
-
hike (~> 1.2)
|
55
|
-
multi_json (~> 1.0)
|
56
|
-
rack (~> 1.0)
|
57
|
-
tilt (~> 1.1, != 1.3.0)
|
58
41
|
thor (0.19.1)
|
59
|
-
|
42
|
+
thread_safe (0.3.4)
|
43
|
+
tzinfo (1.2.2)
|
44
|
+
thread_safe (~> 0.1)
|
60
45
|
|
61
46
|
PLATFORMS
|
62
47
|
ruby
|
63
48
|
|
64
49
|
DEPENDENCIES
|
65
|
-
actionpack (~> 3.2.0)
|
66
50
|
bundler (~> 1.6)
|
67
51
|
minitest
|
68
|
-
railties (~> 3.2.0)
|
69
52
|
rake
|
70
53
|
strong_actions!
|
data/HISTORY.md
CHANGED
@@ -9,12 +9,6 @@ module StrongActions
|
|
9
9
|
role_definition = StrongActions.config.role_definition(role)
|
10
10
|
return true unless role_definition
|
11
11
|
|
12
|
-
begin
|
13
|
-
role_object = @target.instance_eval(role)
|
14
|
-
rescue NameError
|
15
|
-
raise "role #{role} is not defined in controller"
|
16
|
-
end
|
17
|
-
|
18
12
|
controller_value = role_definition[controller_name]
|
19
13
|
return true if controller_value.nil?
|
20
14
|
|
@@ -30,11 +24,21 @@ module StrongActions
|
|
30
24
|
action_value.each do |definition|
|
31
25
|
next if definition === true
|
32
26
|
return false unless definition
|
27
|
+
|
28
|
+
role_object = role_object_for(role)
|
33
29
|
return false unless role_object.instance_eval(definition)
|
34
30
|
end
|
35
31
|
|
36
32
|
true
|
37
33
|
end
|
38
|
-
|
34
|
+
|
35
|
+
def role_object_for(role)
|
36
|
+
begin
|
37
|
+
return @target.instance_eval(role)
|
38
|
+
rescue NameError
|
39
|
+
raise "role #{role} is not defined in controller"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
39
43
|
end
|
40
44
|
end
|
data/test/decision_test.rb
CHANGED
@@ -45,6 +45,11 @@ class DecisionTest < Minitest::Test
|
|
45
45
|
assert decision.call('current_user', 'stores', 'new')
|
46
46
|
end
|
47
47
|
|
48
|
+
def test_role_undefined_and_not_needed
|
49
|
+
assert decision.call('current_user', 'some_actions')
|
50
|
+
assert decision.call('undefined', 'some_actions')
|
51
|
+
end
|
52
|
+
|
48
53
|
end
|
49
54
|
|
50
55
|
class User
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strong_actions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ichy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
157
|
version: '0'
|
158
158
|
requirements: []
|
159
159
|
rubyforge_project:
|
160
|
-
rubygems_version: 2.
|
160
|
+
rubygems_version: 2.4.1
|
161
161
|
signing_key:
|
162
162
|
specification_version: 4
|
163
163
|
summary: access control for rails controller/action
|
@@ -165,3 +165,4 @@ test_files:
|
|
165
165
|
- test/config/acl.yml
|
166
166
|
- test/decision_test.rb
|
167
167
|
- test/test_helper.rb
|
168
|
+
has_rdoc:
|