lockdown 1.5.1 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/lockdown.rb +2 -2
- data/lib/lockdown/frameworks/rails.rb +2 -2
- data/lib/lockdown/frameworks/rails/controller.rb +3 -0
- data/lib/lockdown/session.rb +2 -0
- data/lib/lockdown/system.rb +1 -1
- data/spec/lockdown/frameworks/rails/controller_spec.rb +10 -1
- data/spec/lockdown/frameworks/rails_spec.rb +2 -2
- data/spec/lockdown/system_spec.rb +2 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.6.0
|
data/lib/lockdown.rb
CHANGED
@@ -16,7 +16,7 @@ module Lockdown
|
|
16
16
|
extend Lockdown::References
|
17
17
|
extend Lockdown::Helper
|
18
18
|
|
19
|
-
VERSION = '1.
|
19
|
+
VERSION = '1.6.0'
|
20
20
|
|
21
21
|
class << self
|
22
22
|
attr_accessor :logger
|
@@ -54,7 +54,7 @@ module Lockdown
|
|
54
54
|
|
55
55
|
if File.exists?(Lockdown.init_file)
|
56
56
|
Lockdown.logger.info "=> Requiring Lockdown rules engine: #{Lockdown.init_file} \n"
|
57
|
-
|
57
|
+
load Lockdown.init_file
|
58
58
|
else
|
59
59
|
Lockdown.logger.info "=> Note:: Lockdown couldn't find init file: #{Lockdown.init_file}\n"
|
60
60
|
end
|
@@ -66,14 +66,14 @@ module Lockdown
|
|
66
66
|
# cache_classes is true in production and testing, need to
|
67
67
|
# modify the ApplicationController
|
68
68
|
def controller_parent
|
69
|
-
if
|
69
|
+
if caching?
|
70
70
|
ApplicationController
|
71
71
|
else
|
72
72
|
ActionController::Base
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
def
|
76
|
+
def caching?
|
77
77
|
::Rails.configuration.cache_classes
|
78
78
|
end
|
79
79
|
|
data/lib/lockdown/session.rb
CHANGED
data/lib/lockdown/system.rb
CHANGED
@@ -37,7 +37,8 @@ describe Lockdown::Frameworks::Rails::Controller::Lock do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
describe "#configure_lockdown" do
|
40
|
-
it "should call check_session_expiry and store_location" do
|
40
|
+
it "should call Lockdown.maybe_parse_init, check_session_expiry and store_location" do
|
41
|
+
Lockdown.should_receive(:maybe_parse_init)
|
41
42
|
@controller.should_receive(:check_session_expiry)
|
42
43
|
@controller.should_receive(:store_location)
|
43
44
|
|
@@ -115,6 +116,7 @@ describe Lockdown::Frameworks::Rails::Controller::Lock do
|
|
115
116
|
|
116
117
|
request = mock("request")
|
117
118
|
request.stub!(:method).and_return(:get)
|
119
|
+
Lockdown.stub(:caching?).and_return(true)
|
118
120
|
@controller.stub!(:params).and_return({})
|
119
121
|
@controller.stub!(:request).and_return(request)
|
120
122
|
|
@@ -127,6 +129,13 @@ describe Lockdown::Frameworks::Rails::Controller::Lock do
|
|
127
129
|
URI.stub!(:split).with(@a_path).and_return(a_path_parts)
|
128
130
|
end
|
129
131
|
|
132
|
+
it "should call add_lockdown_session_values unless caching" do
|
133
|
+
Lockdown.stub(:caching?).and_return(false)
|
134
|
+
@controller.should_receive(:add_lockdown_session_values)
|
135
|
+
|
136
|
+
@controller.send(:authorized?,nil)
|
137
|
+
end
|
138
|
+
|
130
139
|
it "should return false if url is nil" do
|
131
140
|
@controller.send(:authorized?,nil).should be_false
|
132
141
|
end
|
@@ -115,12 +115,12 @@ describe Lockdown::Frameworks::Rails::Environment do
|
|
115
115
|
|
116
116
|
describe "#controller_parent" do
|
117
117
|
it "should return ActionController::Base if not caching classes" do
|
118
|
-
@env.should_receive(:
|
118
|
+
@env.should_receive(:caching?).and_return(false)
|
119
119
|
@env.controller_parent.should == ActionController::Base
|
120
120
|
end
|
121
121
|
|
122
122
|
it "should return ApplicationController if caching classes" do
|
123
|
-
@env.should_receive(:
|
123
|
+
@env.should_receive(:caching?).and_return(true)
|
124
124
|
@env.controller_parent.should == ApplicationController
|
125
125
|
end
|
126
126
|
|
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.
|
4
|
+
version: 1.6.0
|
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: 2009-11-
|
12
|
+
date: 2009-11-13 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|