strong_actions 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cb9467219528ebebcfced8aba69697ccce65389
4
- data.tar.gz: 968f1316ff553ee8f9075acb4797e8d875f0a467
3
+ metadata.gz: 50e942a006bbdf85a8eaeca098f6a25613c0ae0d
4
+ data.tar.gz: 0baceb772e16461e26cab97ce45d63acfd606ac1
5
5
  SHA512:
6
- metadata.gz: 4a6a0c9caf21a3d6d95a3a3cdaeb4f75c1fdce95f9ca2ed5cf8965b0c365097d7080f4a9338fd804c55c133b3755ad5be23a4b63fc2f7525728ae7f5c62467b3
7
- data.tar.gz: 2b72b1197594bda0b7cdbb9f0b5a58504922999f0214405eb073ab5e72b0011b3ec3ac6ef350579e64e94cde3bbbb5cd4e23db54cd9a955c2b12d48e79d46281
6
+ metadata.gz: 6584b0501fdcd0f7d26f62f90064f22e40f0bffe6ab769d03e3c71e77b6a318e8470f68e75464a6168f3584f767407b19b32003ec74b29e472b2b1249c658e74
7
+ data.tar.gz: e7f9ecc39c109054f3bfeeb7be293fd3d80644519ad9f27ea8b60afd07d02cf6c0e8d36f504f7a5137d1d910fc701c1428ab84e8071943405946b369c6ef958b
data/Gemfile.lock CHANGED
@@ -1,71 +1,74 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strong_actions (0.0.9)
5
- actionpack (>= 4.1, < 5.1)
6
- activesupport (>= 4.1, < 5.1)
7
- railties (>= 4.1, < 5.1)
4
+ strong_actions (0.1.0)
5
+ actionpack (>= 4.2, < 5.2)
6
+ activesupport (>= 4.2, < 5.2)
7
+ railties (>= 4.2, < 5.2)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (5.0.2)
13
- actionview (= 5.0.2)
14
- activesupport (= 5.0.2)
12
+ actionpack (5.1.4)
13
+ actionview (= 5.1.4)
14
+ activesupport (= 5.1.4)
15
15
  rack (~> 2.0)
16
- rack-test (~> 0.6.3)
16
+ rack-test (>= 0.6.3)
17
17
  rails-dom-testing (~> 2.0)
18
18
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
19
- actionview (5.0.2)
20
- activesupport (= 5.0.2)
19
+ actionview (5.1.4)
20
+ activesupport (= 5.1.4)
21
21
  builder (~> 3.1)
22
- erubis (~> 2.7.0)
22
+ erubi (~> 1.4)
23
23
  rails-dom-testing (~> 2.0)
24
24
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
25
- activesupport (5.0.2)
25
+ activesupport (5.1.4)
26
26
  concurrent-ruby (~> 1.0, >= 1.0.2)
27
27
  i18n (~> 0.7)
28
28
  minitest (~> 5.1)
29
29
  tzinfo (~> 1.1)
30
30
  builder (3.2.3)
31
31
  concurrent-ruby (1.0.5)
32
- erubis (2.7.0)
33
- i18n (0.8.1)
34
- loofah (2.0.3)
32
+ crass (1.0.3)
33
+ erubi (1.7.0)
34
+ i18n (0.9.4)
35
+ concurrent-ruby (~> 1.0)
36
+ loofah (2.1.1)
37
+ crass (~> 1.0.2)
35
38
  nokogiri (>= 1.5.9)
36
- method_source (0.8.2)
37
- mini_portile2 (2.1.0)
38
- minitest (5.10.1)
39
- nokogiri (1.7.1)
40
- mini_portile2 (~> 2.1.0)
41
- rack (2.0.1)
42
- rack-test (0.6.3)
43
- rack (>= 1.0)
44
- rails-dom-testing (2.0.2)
45
- activesupport (>= 4.2.0, < 6.0)
46
- nokogiri (~> 1.6)
39
+ method_source (0.9.0)
40
+ mini_portile2 (2.3.0)
41
+ minitest (5.11.3)
42
+ nokogiri (1.8.2)
43
+ mini_portile2 (~> 2.3.0)
44
+ rack (2.0.4)
45
+ rack-test (0.8.2)
46
+ rack (>= 1.0, < 3)
47
+ rails-dom-testing (2.0.3)
48
+ activesupport (>= 4.2.0)
49
+ nokogiri (>= 1.6)
47
50
  rails-html-sanitizer (1.0.3)
48
51
  loofah (~> 2.0)
49
- railties (5.0.2)
50
- actionpack (= 5.0.2)
51
- activesupport (= 5.0.2)
52
+ railties (5.1.4)
53
+ actionpack (= 5.1.4)
54
+ activesupport (= 5.1.4)
52
55
  method_source
53
56
  rake (>= 0.8.7)
54
57
  thor (>= 0.18.1, < 2.0)
55
- rake (12.0.0)
56
- thor (0.19.4)
58
+ rake (12.3.0)
59
+ thor (0.20.0)
57
60
  thread_safe (0.3.6)
58
- tzinfo (1.2.3)
61
+ tzinfo (1.2.5)
59
62
  thread_safe (~> 0.1)
60
63
 
61
64
  PLATFORMS
62
65
  ruby
63
66
 
64
67
  DEPENDENCIES
65
- bundler (~> 1.7)
68
+ bundler (~> 1.16)
66
69
  minitest
67
70
  rake (~> 12.0)
68
71
  strong_actions!
69
72
 
70
73
  BUNDLED WITH
71
- 1.13.7
74
+ 1.16.1
data/HISTORY.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # History
2
2
 
3
+ ## 0.1.0
4
+ * drop support for ruby-2.1
5
+ * drop support for rails-4.1
6
+ * add suport for rails-5.1
7
+
3
8
  ## 0.0.9
4
9
  * fixed thread safety issue on multi-thread environment.
5
10
 
data/README.md CHANGED
@@ -26,53 +26,53 @@ Suppose method "current_user" is available for controllers and views,
26
26
  and user has an attribute called admin and only admin can modify resource "users",
27
27
 
28
28
  then prepare config/acl.yml
29
-
30
- current_user:
31
- users:
32
- new: admin?
33
- create: admin?
34
- edit: admin?
35
- update: admin?
36
- destroy: admin?
37
-
29
+ ```yaml
30
+ current_user:
31
+ users:
32
+ new: admin?
33
+ create: admin?
34
+ edit: admin?
35
+ update: admin?
36
+ destroy: admin?
37
+ ```
38
38
  In above case, when a non-admin user try to access new_user_path, StrongActions::ForbiddenAction is thrown.
39
39
 
40
40
  if all actions are restricted in the same way, you can make a definition on controller level.
41
-
42
- current_user:
43
- users: admin?
44
-
41
+ ```yaml
42
+ current_user:
43
+ users: admin?
44
+ ```
45
45
  controller definition can be namespaced.
46
-
47
- current_user:
48
- admin/users: admin?
49
-
46
+ ```yaml
47
+ current_user:
48
+ admin/users: admin?
49
+ ```
50
50
  if you have multiple controllers under a namespace, namespace can be used.
51
51
  ending with '/' indicates that is for namespace 'admin' and not controller 'admin'.
52
-
53
- current_user:
54
- admin/: admin?
55
-
52
+ ```yaml
53
+ current_user:
54
+ admin/: admin?
55
+ ```
56
56
 
57
57
  ### Handling error in controller
58
58
 
59
59
  In application_controller.rb, the error should be rescued like
60
-
61
- rescue_from StrongActions::ForbiddenAction do
62
- render :file => 'public/403.html', :layout => false, :status => :forbidden
63
- end
64
-
60
+ ```ruby
61
+ rescue_from StrongActions::ForbiddenAction do
62
+ render :file => 'public/403.html', :layout => false, :status => :forbidden
63
+ end
64
+ ```
65
65
  In above case, all the forbidden accesses are handled by public/403.html.
66
66
 
67
67
  ### Disabling forbidden link in view
68
68
 
69
69
  In views, use helper method "available?" so that links for forbidden actions are not shown.
70
-
71
- <%= link_to 'Add User' new_user_path if available?('users', 'new') %>
72
-
70
+ ```erb
71
+ <%= link_to 'Add User' new_user_path if available?('users', 'new') %>
72
+ ```
73
73
  ## Contributing
74
74
 
75
- 1. Fork it ( https://github.com/[my-github-username]/strong_actions/fork )
75
+ 1. Fork it ( https://github.com/hybitz/strong_actions/fork )
76
76
  2. Create your feature branch (`git checkout -b my-new-feature`)
77
77
  3. Commit your changes (`git commit -am 'Add some feature'`)
78
78
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,3 +1,3 @@
1
1
  module StrongActions
2
- VERSION = '0.0.9'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -17,13 +17,13 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.required_ruby_version = '~> 2.1'
20
+ spec.required_ruby_version = '~> 2.2'
21
21
 
22
- spec.add_dependency "activesupport", '>= 4.1', '< 5.1'
23
- spec.add_dependency "actionpack", '>= 4.1', '< 5.1'
24
- spec.add_dependency "railties", '>= 4.1', '< 5.1'
22
+ spec.add_dependency "activesupport", '>= 4.2', '< 5.2'
23
+ spec.add_dependency "actionpack", '>= 4.2', '< 5.2'
24
+ spec.add_dependency "railties", '>= 4.2', '< 5.2'
25
25
 
26
- spec.add_development_dependency "bundler", "~> 1.7"
26
+ spec.add_development_dependency "bundler", "~> 1.16"
27
27
  spec.add_development_dependency "minitest"
28
28
  spec.add_development_dependency "rake", "~> 12.0"
29
29
  end
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.9
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ichy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-01 00:00:00.000000000 Z
11
+ date: 2018-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -16,74 +16,74 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '4.1'
19
+ version: '4.2'
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.1'
22
+ version: '5.2'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: '4.1'
29
+ version: '4.2'
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.1'
32
+ version: '5.2'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: actionpack
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '4.1'
39
+ version: '4.2'
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '5.1'
42
+ version: '5.2'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: '4.1'
49
+ version: '4.2'
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '5.1'
52
+ version: '5.2'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: railties
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: '4.1'
59
+ version: '4.2'
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
- version: '5.1'
62
+ version: '5.2'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '4.1'
69
+ version: '4.2'
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
- version: '5.1'
72
+ version: '5.2'
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: bundler
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
77
  - - "~>"
78
78
  - !ruby/object:Gem::Version
79
- version: '1.7'
79
+ version: '1.16'
80
80
  type: :development
81
81
  prerelease: false
82
82
  version_requirements: !ruby/object:Gem::Requirement
83
83
  requirements:
84
84
  - - "~>"
85
85
  - !ruby/object:Gem::Version
86
- version: '1.7'
86
+ version: '1.16'
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: minitest
89
89
  requirement: !ruby/object:Gem::Requirement
@@ -153,7 +153,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
153
  requirements:
154
154
  - - "~>"
155
155
  - !ruby/object:Gem::Version
156
- version: '2.1'
156
+ version: '2.2'
157
157
  required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  requirements:
159
159
  - - ">="
@@ -161,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
161
161
  version: '0'
162
162
  requirements: []
163
163
  rubyforge_project:
164
- rubygems_version: 2.6.4
164
+ rubygems_version: 2.6.13
165
165
  signing_key:
166
166
  specification_version: 4
167
167
  summary: access control for rails controller/action