lockdown 1.6.3 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/lockdown/frameworks/rails/view.rb +3 -2
- data/lib/lockdown.rb +1 -1
- data/lockdown.gemspec +2 -2
- data/spec/lockdown/frameworks/rails/view_spec.rb +11 -2
- metadata +2 -2
@@ -11,11 +11,11 @@ module Lockdown
|
|
11
11
|
alias_method :button_to, :button_to_secured
|
12
12
|
end
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def link_to_secured(name, options = {}, html_options = nil)
|
16
16
|
url = url_for(options)
|
17
17
|
|
18
|
-
method = html_options ? html_options[:method] : :get
|
18
|
+
method = html_options && html_options[:method] ? html_options[:method] : :get
|
19
19
|
|
20
20
|
if authorized?(url, method)
|
21
21
|
return link_to_open(name, url, html_options)
|
@@ -48,3 +48,4 @@ module Lockdown
|
|
48
48
|
end # Rails
|
49
49
|
end # Frameworks
|
50
50
|
end # Lockdown
|
51
|
+
|
data/lib/lockdown.rb
CHANGED
data/lockdown.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{lockdown}
|
8
|
-
s.version = "1.6.
|
8
|
+
s.version = "1.6.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andrew Stone"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-02-08}
|
13
13
|
s.description = %q{Restrict access to your controller actions. Supports basic model level restrictions as well}
|
14
14
|
s.email = %q{andy@stonean.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -35,7 +35,15 @@ describe Lockdown::Frameworks::Rails::Controller do
|
|
35
35
|
@view.stub!(:authorized?).and_return(false)
|
36
36
|
|
37
37
|
@view.link_to_secured("my link", @options).should == ""
|
38
|
-
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should use the default "get" when html_options[:method] is nil' do
|
41
|
+
link = "<a href='http://a.com'>my_link</a>"
|
42
|
+
|
43
|
+
@view.should_receive(:authorized?).with('posts/new', :get)
|
44
|
+
|
45
|
+
@view.link_to_secured("my link", @options, {})
|
46
|
+
end
|
39
47
|
end
|
40
48
|
|
41
49
|
describe "#button_to_secured" do
|
@@ -51,7 +59,7 @@ describe Lockdown::Frameworks::Rails::Controller do
|
|
51
59
|
@view.stub!(:authorized?).and_return(false)
|
52
60
|
|
53
61
|
@view.button_to_secured("my link", @options).should == ""
|
54
|
-
end
|
62
|
+
end
|
55
63
|
end
|
56
64
|
|
57
65
|
describe "#link_to_or_show" do
|
@@ -85,3 +93,4 @@ describe Lockdown::Frameworks::Rails::Controller do
|
|
85
93
|
end
|
86
94
|
end
|
87
95
|
end
|
96
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lockdown
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Stone
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-02-08 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|