comfortable_mexican_sofa 1.4.3 → 1.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +5 -2
- data/VERSION +1 -1
- data/app/controllers/cms_admin/base_controller.rb +1 -1
- data/app/controllers/cms_content_controller.rb +8 -3
- data/comfortable_mexican_sofa.gemspec +6 -3
- data/config/initializers/comfortable_mexican_sofa.rb +6 -1
- data/gemfiles/Gemfile.rails-3.0.x +14 -0
- data/gemfiles/Gemfile.rails-3.1.x +14 -0
- data/lib/comfortable_mexican_sofa.rb +2 -1
- data/lib/comfortable_mexican_sofa/authentication/dummy_auth.rb +8 -0
- data/lib/comfortable_mexican_sofa/{http_auth.rb → authentication/http_auth.rb} +0 -0
- data/lib/comfortable_mexican_sofa/configuration.rb +6 -2
- data/test/integration/authentication_test.rb +23 -2
- data/test/test_helper.rb +2 -1
- data/test/unit/configuration_test.rb +2 -1
- metadata +13 -10
data/.travis.yml
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.4.
|
1
|
+
1.4.4
|
@@ -3,7 +3,7 @@ class CmsAdmin::BaseController < ApplicationController
|
|
3
3
|
protect_from_forgery
|
4
4
|
|
5
5
|
# Authentication module must have #authenticate method
|
6
|
-
include ComfortableMexicanSofa.config.
|
6
|
+
include ComfortableMexicanSofa.config.admin_auth.to_s.constantize
|
7
7
|
|
8
8
|
before_filter :authenticate,
|
9
9
|
:load_admin_site,
|
@@ -1,9 +1,14 @@
|
|
1
1
|
class CmsContentController < ApplicationController
|
2
|
-
|
2
|
+
|
3
|
+
# Authentication module must have #authenticate method
|
4
|
+
include ComfortableMexicanSofa.config.public_auth.to_s.constantize
|
5
|
+
|
3
6
|
before_filter :load_cms_site
|
4
7
|
before_filter :load_fixtures
|
5
|
-
before_filter :load_cms_page,
|
6
|
-
|
8
|
+
before_filter :load_cms_page, :authenticate,
|
9
|
+
:only => :render_html
|
10
|
+
before_filter :load_cms_layout,
|
11
|
+
:only => [:render_css, :render_js]
|
7
12
|
|
8
13
|
def render_html(status = 200)
|
9
14
|
if layout = @cms_page.layout
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{comfortable_mexican_sofa}
|
8
|
-
s.version = "1.4.
|
8
|
+
s.version = "1.4.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Oleg Khabarov", "The Working Group Inc"]
|
12
|
-
s.date = %q{2011-08-
|
12
|
+
s.date = %q{2011-08-30}
|
13
13
|
s.description = %q{}
|
14
14
|
s.email = %q{oleg@theworkinggroup.ca}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -198,7 +198,11 @@ Gem::Specification.new do |s|
|
|
198
198
|
"db/seeds.rb",
|
199
199
|
"doc/page_editing.png",
|
200
200
|
"doc/sofa.png",
|
201
|
+
"gemfiles/Gemfile.rails-3.0.x",
|
202
|
+
"gemfiles/Gemfile.rails-3.1.x",
|
201
203
|
"lib/comfortable_mexican_sofa.rb",
|
204
|
+
"lib/comfortable_mexican_sofa/authentication/dummy_auth.rb",
|
205
|
+
"lib/comfortable_mexican_sofa/authentication/http_auth.rb",
|
202
206
|
"lib/comfortable_mexican_sofa/configuration.rb",
|
203
207
|
"lib/comfortable_mexican_sofa/controller_methods.rb",
|
204
208
|
"lib/comfortable_mexican_sofa/engine.rb",
|
@@ -210,7 +214,6 @@ Gem::Specification.new do |s|
|
|
210
214
|
"lib/comfortable_mexican_sofa/extensions/rails.rb",
|
211
215
|
"lib/comfortable_mexican_sofa/fixtures.rb",
|
212
216
|
"lib/comfortable_mexican_sofa/form_builder.rb",
|
213
|
-
"lib/comfortable_mexican_sofa/http_auth.rb",
|
214
217
|
"lib/comfortable_mexican_sofa/tag.rb",
|
215
218
|
"lib/comfortable_mexican_sofa/tags/asset.rb",
|
216
219
|
"lib/comfortable_mexican_sofa/tags/field_datetime.rb",
|
@@ -6,7 +6,12 @@ ComfortableMexicanSofa.configure do |config|
|
|
6
6
|
|
7
7
|
# Module responsible for authentication. You can replace it with your own.
|
8
8
|
# It simply needs to have #authenticate method. See http_auth.rb for reference.
|
9
|
-
# config.
|
9
|
+
# config.admin_auth = 'ComfortableMexicanSofa::HttpAuth'
|
10
|
+
|
11
|
+
# Module responsible for public authentication. Similar to the above. You also
|
12
|
+
# will have access to @cms_site, @cms_layout, @cms_page so you can use them in
|
13
|
+
# your logic. Default module doesn't do anything.
|
14
|
+
# config.public_auth = 'ComfortableMexicanSofa::DummyAuth'
|
10
15
|
|
11
16
|
# Default url to access admin area is http://yourhost/cms-admin/
|
12
17
|
# You can change 'cms-admin' to 'admin', for example. To disable admin area
|
@@ -6,7 +6,8 @@ end
|
|
6
6
|
[ 'comfortable_mexican_sofa/version',
|
7
7
|
'comfortable_mexican_sofa/error',
|
8
8
|
'comfortable_mexican_sofa/configuration',
|
9
|
-
'comfortable_mexican_sofa/http_auth',
|
9
|
+
'comfortable_mexican_sofa/authentication/http_auth',
|
10
|
+
'comfortable_mexican_sofa/authentication/dummy_auth',
|
10
11
|
'comfortable_mexican_sofa/controller_methods',
|
11
12
|
'comfortable_mexican_sofa/view_hooks',
|
12
13
|
'comfortable_mexican_sofa/view_methods',
|
File without changes
|
@@ -6,7 +6,10 @@ class ComfortableMexicanSofa::Configuration
|
|
6
6
|
attr_accessor :cms_title
|
7
7
|
|
8
8
|
# Module that will handle authentication to access cms-admin area
|
9
|
-
attr_accessor :
|
9
|
+
attr_accessor :admin_auth
|
10
|
+
|
11
|
+
# Module that will handle authentication for public pages
|
12
|
+
attr_accessor :public_auth
|
10
13
|
|
11
14
|
# Default url to access admin area is http://yourhost/cms-admin/
|
12
15
|
# You can change 'cms-admin' to 'admin', for example.
|
@@ -43,7 +46,8 @@ class ComfortableMexicanSofa::Configuration
|
|
43
46
|
# Configuration defaults
|
44
47
|
def initialize
|
45
48
|
@cms_title = 'ComfortableMexicanSofa MicroCMS'
|
46
|
-
@
|
49
|
+
@admin_auth = 'ComfortableMexicanSofa::HttpAuth'
|
50
|
+
@public_auth = 'ComfortableMexicanSofa::DummyAuth'
|
47
51
|
@seed_data_path = nil
|
48
52
|
@admin_route_prefix = 'cms-admin'
|
49
53
|
@admin_route_redirect = ''
|
@@ -2,8 +2,20 @@ require File.expand_path('../test_helper', File.dirname(__FILE__))
|
|
2
2
|
|
3
3
|
class AuthenticationTest < ActionDispatch::IntegrationTest
|
4
4
|
|
5
|
+
module TestLockPublicAuth
|
6
|
+
def authenticate
|
7
|
+
return redirect_to('/lockout')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module TestUnlockPublicAuth
|
12
|
+
def authenticate
|
13
|
+
true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
5
17
|
def test_get_with_unauthorized_access
|
6
|
-
assert_equal 'ComfortableMexicanSofa::HttpAuth', ComfortableMexicanSofa.config.
|
18
|
+
assert_equal 'ComfortableMexicanSofa::HttpAuth', ComfortableMexicanSofa.config.admin_auth
|
7
19
|
get '/cms-admin/sites'
|
8
20
|
assert_response :unauthorized
|
9
21
|
get '/'
|
@@ -16,7 +28,7 @@ class AuthenticationTest < ActionDispatch::IntegrationTest
|
|
16
28
|
end
|
17
29
|
|
18
30
|
def test_get_with_changed_default_config
|
19
|
-
assert_equal 'ComfortableMexicanSofa::HttpAuth', ComfortableMexicanSofa.config.
|
31
|
+
assert_equal 'ComfortableMexicanSofa::HttpAuth', ComfortableMexicanSofa.config.admin_auth
|
20
32
|
ComfortableMexicanSofa::HttpAuth.username = 'newuser'
|
21
33
|
ComfortableMexicanSofa::HttpAuth.password = 'newpass'
|
22
34
|
http_auth :get, '/cms-admin/sites'
|
@@ -24,4 +36,13 @@ class AuthenticationTest < ActionDispatch::IntegrationTest
|
|
24
36
|
http_auth :get, '/cms-admin/sites', {}, 'newuser', 'newpass'
|
25
37
|
assert_response :success
|
26
38
|
end
|
39
|
+
|
40
|
+
def test_get_public_with_custom_auth
|
41
|
+
CmsContentController.send :include, TestLockPublicAuth
|
42
|
+
get '/'
|
43
|
+
assert_response :redirect
|
44
|
+
assert_redirected_to '/lockout'
|
45
|
+
# reset auth module
|
46
|
+
CmsContentController.send :include, TestUnlockPublicAuth
|
47
|
+
end
|
27
48
|
end
|
data/test/test_helper.rb
CHANGED
@@ -17,7 +17,8 @@ class ActiveSupport::TestCase
|
|
17
17
|
def reset_config
|
18
18
|
ComfortableMexicanSofa.configure do |config|
|
19
19
|
config.cms_title = 'ComfortableMexicanSofa MicroCMS'
|
20
|
-
config.
|
20
|
+
config.admin_auth = 'ComfortableMexicanSofa::HttpAuth'
|
21
|
+
config.public_auth = 'ComfortableMexicanSofa::DummyAuth'
|
21
22
|
config.admin_route_prefix = 'cms-admin'
|
22
23
|
config.admin_route_redirect = ''
|
23
24
|
config.allow_irb = false
|
@@ -7,7 +7,8 @@ class ConfigurationTest < ActiveSupport::TestCase
|
|
7
7
|
def test_configuration_presense
|
8
8
|
assert config = ComfortableMexicanSofa.configuration
|
9
9
|
assert_equal 'ComfortableMexicanSofa MicroCMS', config.cms_title
|
10
|
-
assert_equal 'ComfortableMexicanSofa::HttpAuth', config.
|
10
|
+
assert_equal 'ComfortableMexicanSofa::HttpAuth', config.admin_auth
|
11
|
+
assert_equal 'ComfortableMexicanSofa::DummyAuth', config.public_auth
|
11
12
|
assert_equal 'cms-admin', config.admin_route_prefix
|
12
13
|
assert_equal '', config.admin_route_redirect
|
13
14
|
assert_equal false, config.allow_irb
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comfortable_mexican_sofa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,12 +10,12 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2011-08-
|
13
|
+
date: 2011-08-30 00:00:00.000000000 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
18
|
-
requirement: &
|
18
|
+
requirement: &70319984307860 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ! '>='
|
@@ -23,10 +23,10 @@ dependencies:
|
|
23
23
|
version: 3.0.0
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
|
-
version_requirements: *
|
26
|
+
version_requirements: *70319984307860
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: active_link_to
|
29
|
-
requirement: &
|
29
|
+
requirement: &70319984307380 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ! '>='
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
version: 1.0.0
|
35
35
|
type: :runtime
|
36
36
|
prerelease: false
|
37
|
-
version_requirements: *
|
37
|
+
version_requirements: *70319984307380
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
39
|
name: paperclip
|
40
|
-
requirement: &
|
40
|
+
requirement: &70319984306900 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
43
|
- - ! '>='
|
@@ -45,7 +45,7 @@ dependencies:
|
|
45
45
|
version: 2.3.14
|
46
46
|
type: :runtime
|
47
47
|
prerelease: false
|
48
|
-
version_requirements: *
|
48
|
+
version_requirements: *70319984306900
|
49
49
|
description: ''
|
50
50
|
email: oleg@theworkinggroup.ca
|
51
51
|
executables: []
|
@@ -235,7 +235,11 @@ files:
|
|
235
235
|
- db/seeds.rb
|
236
236
|
- doc/page_editing.png
|
237
237
|
- doc/sofa.png
|
238
|
+
- gemfiles/Gemfile.rails-3.0.x
|
239
|
+
- gemfiles/Gemfile.rails-3.1.x
|
238
240
|
- lib/comfortable_mexican_sofa.rb
|
241
|
+
- lib/comfortable_mexican_sofa/authentication/dummy_auth.rb
|
242
|
+
- lib/comfortable_mexican_sofa/authentication/http_auth.rb
|
239
243
|
- lib/comfortable_mexican_sofa/configuration.rb
|
240
244
|
- lib/comfortable_mexican_sofa/controller_methods.rb
|
241
245
|
- lib/comfortable_mexican_sofa/engine.rb
|
@@ -247,7 +251,6 @@ files:
|
|
247
251
|
- lib/comfortable_mexican_sofa/extensions/rails.rb
|
248
252
|
- lib/comfortable_mexican_sofa/fixtures.rb
|
249
253
|
- lib/comfortable_mexican_sofa/form_builder.rb
|
250
|
-
- lib/comfortable_mexican_sofa/http_auth.rb
|
251
254
|
- lib/comfortable_mexican_sofa/tag.rb
|
252
255
|
- lib/comfortable_mexican_sofa/tags/asset.rb
|
253
256
|
- lib/comfortable_mexican_sofa/tags/field_datetime.rb
|
@@ -344,7 +347,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
344
347
|
version: '0'
|
345
348
|
segments:
|
346
349
|
- 0
|
347
|
-
hash:
|
350
|
+
hash: 4080205680426409607
|
348
351
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
349
352
|
none: false
|
350
353
|
requirements:
|