strong_actions 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +76 -1
- data/HISTORY.md +10 -0
- data/README.md +17 -1
- data/lib/strong_actions/controller_extentions.rb +7 -1
- data/lib/strong_actions/version.rb +1 -1
- data/strong_actions.gemspec +1 -0
- metadata +22 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2c48a2da760c3262f2fd6e85252adbc449c0423
|
4
|
+
data.tar.gz: 7a7e3856a3685a776c7b5b2a40de6181253df329
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 844ddabc77a3aa695c9ba9210a986c3b2bd032ae1dc02b162f8c6aec8b3783fef21264fd6fd9fc138bdd79c824f9574a270a226d7fc43e5b6fda1fff0e1a2d91
|
7
|
+
data.tar.gz: f45aa6a8bdf8dfe320faa719ccbe61800d7259c6cc608a3d79bf632b5ae11e4f44171fe62cefcb7914708ea35a7017a0a7ee5c13ba4d54c3ea73bac7b6e639a8
|
data/Gemfile.lock
CHANGED
@@ -1,17 +1,92 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
strong_actions (0.0.
|
4
|
+
strong_actions (0.0.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
actionmailer (4.1.5)
|
10
|
+
actionpack (= 4.1.5)
|
11
|
+
actionview (= 4.1.5)
|
12
|
+
mail (~> 2.5.4)
|
13
|
+
actionpack (4.1.5)
|
14
|
+
actionview (= 4.1.5)
|
15
|
+
activesupport (= 4.1.5)
|
16
|
+
rack (~> 1.5.2)
|
17
|
+
rack-test (~> 0.6.2)
|
18
|
+
actionview (4.1.5)
|
19
|
+
activesupport (= 4.1.5)
|
20
|
+
builder (~> 3.1)
|
21
|
+
erubis (~> 2.7.0)
|
22
|
+
activemodel (4.1.5)
|
23
|
+
activesupport (= 4.1.5)
|
24
|
+
builder (~> 3.1)
|
25
|
+
activerecord (4.1.5)
|
26
|
+
activemodel (= 4.1.5)
|
27
|
+
activesupport (= 4.1.5)
|
28
|
+
arel (~> 5.0.0)
|
29
|
+
activesupport (4.1.5)
|
30
|
+
i18n (~> 0.6, >= 0.6.9)
|
31
|
+
json (~> 1.7, >= 1.7.7)
|
32
|
+
minitest (~> 5.1)
|
33
|
+
thread_safe (~> 0.1)
|
34
|
+
tzinfo (~> 1.1)
|
35
|
+
arel (5.0.1.20140414130214)
|
36
|
+
builder (3.2.2)
|
37
|
+
erubis (2.7.0)
|
38
|
+
hike (1.2.3)
|
39
|
+
i18n (0.6.11)
|
40
|
+
json (1.8.1)
|
41
|
+
mail (2.5.4)
|
42
|
+
mime-types (~> 1.16)
|
43
|
+
treetop (~> 1.4.8)
|
44
|
+
mime-types (1.25.1)
|
45
|
+
minitest (5.4.1)
|
46
|
+
multi_json (1.10.1)
|
47
|
+
polyglot (0.3.5)
|
48
|
+
rack (1.5.2)
|
49
|
+
rack-test (0.6.2)
|
50
|
+
rack (>= 1.0)
|
51
|
+
rails (4.1.5)
|
52
|
+
actionmailer (= 4.1.5)
|
53
|
+
actionpack (= 4.1.5)
|
54
|
+
actionview (= 4.1.5)
|
55
|
+
activemodel (= 4.1.5)
|
56
|
+
activerecord (= 4.1.5)
|
57
|
+
activesupport (= 4.1.5)
|
58
|
+
bundler (>= 1.3.0, < 2.0)
|
59
|
+
railties (= 4.1.5)
|
60
|
+
sprockets-rails (~> 2.0)
|
61
|
+
railties (4.1.5)
|
62
|
+
actionpack (= 4.1.5)
|
63
|
+
activesupport (= 4.1.5)
|
64
|
+
rake (>= 0.8.7)
|
65
|
+
thor (>= 0.18.1, < 2.0)
|
9
66
|
rake (10.3.2)
|
67
|
+
sprockets (2.12.1)
|
68
|
+
hike (~> 1.2)
|
69
|
+
multi_json (~> 1.0)
|
70
|
+
rack (~> 1.0)
|
71
|
+
tilt (~> 1.1, != 1.3.0)
|
72
|
+
sprockets-rails (2.1.3)
|
73
|
+
actionpack (>= 3.0)
|
74
|
+
activesupport (>= 3.0)
|
75
|
+
sprockets (~> 2.8)
|
76
|
+
thor (0.19.1)
|
77
|
+
thread_safe (0.3.4)
|
78
|
+
tilt (1.4.1)
|
79
|
+
treetop (1.4.15)
|
80
|
+
polyglot
|
81
|
+
polyglot (>= 0.3.1)
|
82
|
+
tzinfo (1.2.2)
|
83
|
+
thread_safe (~> 0.1)
|
10
84
|
|
11
85
|
PLATFORMS
|
12
86
|
ruby
|
13
87
|
|
14
88
|
DEPENDENCIES
|
15
89
|
bundler (~> 1.6)
|
90
|
+
rails (>= 3.2.0, < 5.0.0)
|
16
91
|
rake
|
17
92
|
strong_actions!
|
data/HISTORY.md
ADDED
data/README.md
CHANGED
@@ -18,7 +18,23 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
21
|
+
Suppose method "current_user" is available for controllers and views,
|
22
|
+
|
23
|
+
and user has an attribute called admin and only admin can modify resource "users",
|
24
|
+
|
25
|
+
then prepare config/acl.yml
|
26
|
+
|
27
|
+
current_user:
|
28
|
+
users:
|
29
|
+
new: admin?
|
30
|
+
create: admin?
|
31
|
+
edit: admin?
|
32
|
+
update: admin?
|
33
|
+
destroy: admin?
|
34
|
+
|
35
|
+
In views, use helper_method "available?"
|
36
|
+
|
37
|
+
<%= link_to 'Add User' new_user_path if available?('users', 'new') %>
|
22
38
|
|
23
39
|
## Contributing
|
24
40
|
|
@@ -3,7 +3,12 @@ module StrongActions
|
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
5
|
included do
|
6
|
-
|
6
|
+
if ::ActionPack::VERSION::MAJOR < 4
|
7
|
+
before_filter :authorize_roles!
|
8
|
+
else
|
9
|
+
before_action :authorize_roles!
|
10
|
+
end
|
11
|
+
|
7
12
|
helper_method :available?
|
8
13
|
end
|
9
14
|
|
@@ -50,6 +55,7 @@ module StrongActions
|
|
50
55
|
|
51
56
|
action_value = [action_value] unless action_value.is_a?(Array)
|
52
57
|
action_value.each do |definition|
|
58
|
+
next if definition === true
|
53
59
|
return false unless definition
|
54
60
|
return false unless role_object.instance_eval(definition)
|
55
61
|
end
|
data/strong_actions.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ichy
|
@@ -38,6 +38,26 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.2.0
|
48
|
+
- - <
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 5.0.0
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: 3.2.0
|
58
|
+
- - <
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 5.0.0
|
41
61
|
description: access control for rails controller/action
|
42
62
|
email:
|
43
63
|
- ichylinux@gmail.com
|
@@ -48,6 +68,7 @@ files:
|
|
48
68
|
- .gitignore
|
49
69
|
- Gemfile
|
50
70
|
- Gemfile.lock
|
71
|
+
- HISTORY.md
|
51
72
|
- LICENSE
|
52
73
|
- LICENSE.txt
|
53
74
|
- README.md
|