restful_acl 2.1.0 → 2.1.1
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.
- data/{LICENSE → MIT-LICENSE} +1 -1
- data/README.textile +9 -16
- data/VERSION +1 -1
- data/restful_acl.gemspec +5 -16
- data/uninstall.rb +1 -0
- metadata +6 -14
- data/.document +0 -5
- data/.gitignore +0 -21
- data/spec/restful_acl_spec.rb +0 -75
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -10
- data/spec/widgets.rb +0 -12
data/{LICENSE → MIT-LICENSE}
RENAMED
data/README.textile
CHANGED
@@ -19,9 +19,8 @@ Add the gem to your environment.rb file as thus:
|
|
19
19
|
<pre>config.gem "mdarby-restful_acl", :lib => 'restful_acl_controller'</pre>
|
20
20
|
|
21
21
|
RESTful_ACL requires two named routes: "error" and "denied". Add the following to your routes.rb file:
|
22
|
-
<pre>
|
23
|
-
|
24
|
-
map.denied 'denied', :controller => 'some_controller', :action => 'denied_action'
|
22
|
+
<pre> map.error 'error', :controller => 'some_controller', :action => 'error_action'
|
23
|
+
map.denied 'denied', :controller => 'some_controller', :action => 'denied_action'
|
25
24
|
</pre>
|
26
25
|
|
27
26
|
h3. How to Use
|
@@ -40,32 +39,27 @@ Define a parent resource (if one exists) by using the @logical_parent@ method, a
|
|
40
39
|
|
41
40
|
# This method checks permissions for the :index action
|
42
41
|
def self.is_indexable_by(user, parent = nil)
|
43
|
-
|
44
42
|
end
|
45
43
|
|
46
44
|
# This method checks permissions for the :create and :new action
|
47
45
|
def self.is_creatable_by(user, parent = nil)
|
48
|
-
|
49
46
|
end
|
50
47
|
|
51
48
|
# This method checks permissions for the :show action
|
52
49
|
def is_readable_by(user, parent = nil)
|
53
|
-
|
54
50
|
end
|
55
51
|
|
56
52
|
# This method checks permissions for the :update and :edit action
|
57
53
|
def is_updatable_by(user, parent = nil)
|
58
|
-
|
59
54
|
end
|
60
55
|
|
61
56
|
# This method checks permissions for the :destroy action
|
62
57
|
def is_deletable_by(user, parent = nil)
|
63
|
-
|
64
58
|
end
|
65
59
|
end
|
66
60
|
</pre>
|
67
61
|
|
68
|
-
|
62
|
+
h4. Singleton Resources
|
69
63
|
|
70
64
|
RESTful_ACL 2.1+ supports singleton resources. Just pass @:singleton@ to the @logical_parent@
|
71
65
|
|
@@ -79,12 +73,11 @@ RESTful_ACL 2.1+ supports singleton resources. Just pass @:singleton@ to the @lo
|
|
79
73
|
h4. View Helpers
|
80
74
|
|
81
75
|
There are five view helpers also included in RESTful_ACL: @#indexable@, @#creatable@, @#readable@, @#updatable@, and @#deletable@. These enable you to do nifty things like:
|
82
|
-
<pre
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
<%= link_to 'Delete Foo', foo_path(@foo) if deletable(@foo), :method => :destroy %>
|
76
|
+
<pre>= link_to ‘Foo Index’, foos_path if indexable
|
77
|
+
= link_to 'Edit Foo', edit_foo_path(@foo) if updatable(@foo)
|
78
|
+
= link_to 'Create Foo', new_foo_path if creatable
|
79
|
+
= link_to 'View Foo', foo_path(@foo) if readable(@foo)
|
80
|
+
= link_to 'Delete Foo', foo_path(@foo) if deletable(@foo), :method => :destroy
|
88
81
|
</pre>
|
89
82
|
|
90
83
|
h3. Huh? Here's an example
|
@@ -163,4 +156,4 @@ h3. About the Author
|
|
163
156
|
|
164
157
|
My name is "Matt Darby.":http://blog.matt-darby.com I’m an IT Manager and pro-web-dev at for "Dynamix Engineering":http://dynamix-ltd.com and hold a Master’s Degree in Computer Science from "Franklin University":http://www.franklin.edu in sunny "Columbus, OH.":http://en.wikipedia.org/wiki/Columbus,_Ohio
|
165
158
|
|
166
|
-
Feel free to check out my "blog":http://blog.matt-darby.com or "recommend me":http://www.workingwithrails.com/person/10908-matt-darby
|
159
|
+
Feel free to check out my "blog":http://blog.matt-darby.com or "recommend me":http://www.workingwithrails.com/person/10908-matt-darby
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.
|
1
|
+
2.1.1
|
data/restful_acl.gemspec
CHANGED
@@ -5,21 +5,18 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{restful_acl}
|
8
|
-
s.version = "2.1.
|
8
|
+
s.version = "2.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Matt Darby"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-24}
|
13
13
|
s.description = %q{A Ruby on Rails plugin that provides fine grained access control to RESTful resources.}
|
14
14
|
s.email = %q{matt@matt-darby.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
|
-
"
|
17
|
-
"README.textile"
|
16
|
+
"README.textile"
|
18
17
|
]
|
19
18
|
s.files = [
|
20
|
-
"
|
21
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
19
|
+
"MIT-LICENSE",
|
23
20
|
"README.textile",
|
24
21
|
"Rakefile",
|
25
22
|
"VERSION",
|
@@ -29,21 +26,13 @@ Gem::Specification.new do |s|
|
|
29
26
|
"lib/model.rb",
|
30
27
|
"rails/init.rb",
|
31
28
|
"restful_acl.gemspec",
|
32
|
-
"
|
33
|
-
"spec/spec.opts",
|
34
|
-
"spec/spec_helper.rb",
|
35
|
-
"spec/widgets.rb"
|
29
|
+
"uninstall.rb"
|
36
30
|
]
|
37
31
|
s.homepage = %q{http://github.com/mdarby/restful_acl}
|
38
32
|
s.rdoc_options = ["--charset=UTF-8"]
|
39
33
|
s.require_paths = ["lib"]
|
40
34
|
s.rubygems_version = %q{1.3.5}
|
41
35
|
s.summary = %q{A Ruby on Rails plugin that provides fine grained access control to RESTful resources.}
|
42
|
-
s.test_files = [
|
43
|
-
"spec/restful_acl_spec.rb",
|
44
|
-
"spec/spec_helper.rb",
|
45
|
-
"spec/widgets.rb"
|
46
|
-
]
|
47
36
|
|
48
37
|
if s.respond_to? :specification_version then
|
49
38
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
data/uninstall.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Uninstall hook code here
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restful_acl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Darby
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-11-
|
12
|
+
date: 2009-11-24 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -29,12 +29,9 @@ executables: []
|
|
29
29
|
extensions: []
|
30
30
|
|
31
31
|
extra_rdoc_files:
|
32
|
-
- LICENSE
|
33
32
|
- README.textile
|
34
33
|
files:
|
35
|
-
-
|
36
|
-
- .gitignore
|
37
|
-
- LICENSE
|
34
|
+
- MIT-LICENSE
|
38
35
|
- README.textile
|
39
36
|
- Rakefile
|
40
37
|
- VERSION
|
@@ -44,10 +41,7 @@ files:
|
|
44
41
|
- lib/model.rb
|
45
42
|
- rails/init.rb
|
46
43
|
- restful_acl.gemspec
|
47
|
-
-
|
48
|
-
- spec/spec.opts
|
49
|
-
- spec/spec_helper.rb
|
50
|
-
- spec/widgets.rb
|
44
|
+
- uninstall.rb
|
51
45
|
has_rdoc: true
|
52
46
|
homepage: http://github.com/mdarby/restful_acl
|
53
47
|
licenses: []
|
@@ -76,7 +70,5 @@ rubygems_version: 1.3.5
|
|
76
70
|
signing_key:
|
77
71
|
specification_version: 3
|
78
72
|
summary: A Ruby on Rails plugin that provides fine grained access control to RESTful resources.
|
79
|
-
test_files:
|
80
|
-
|
81
|
-
- spec/spec_helper.rb
|
82
|
-
- spec/widgets.rb
|
73
|
+
test_files: []
|
74
|
+
|
data/.document
DELETED
data/.gitignore
DELETED
data/spec/restful_acl_spec.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "RestfulAcl" do
|
4
|
-
|
5
|
-
describe "when used in a RESTful resource" do
|
6
|
-
|
7
|
-
before do
|
8
|
-
@widget = Widget.new
|
9
|
-
end
|
10
|
-
|
11
|
-
describe "handling GET index" do
|
12
|
-
it "does something" do
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
describe "handling GET show" do
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
describe "handling GET new" do
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
describe "handling GET edit" do
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
describe "handling POST create" do
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "handling PUT update" do
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
describe "handling DELETE destroy" do
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
end
|
41
|
-
|
42
|
-
describe "when used in a Singleton resource" do
|
43
|
-
|
44
|
-
describe "handling GET index" do
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
describe "handling GET show" do
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
describe "handling GET new" do
|
53
|
-
|
54
|
-
end
|
55
|
-
|
56
|
-
describe "handling GET edit" do
|
57
|
-
|
58
|
-
end
|
59
|
-
|
60
|
-
describe "handling POST create" do
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
describe "handling PUT update" do
|
65
|
-
|
66
|
-
end
|
67
|
-
|
68
|
-
describe "handling DELETE destroy" do
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/spec/spec_helper.rb
DELETED