Skip to content
Permalink
Browse files

Don't override :session_id setting if it's being set somewhere else when

the admin starts, see: #500 (comment)
  • Loading branch information
Darío Javier Cravero
Darío Javier Cravero committed Apr 25, 2013
1 parent 4b1ea34 commit 6228bcc3dc583f77c23a9102ef4d9aad83562667
Showing with 21 additions and 1 deletion.
  1. +1 −1 padrino-admin/lib/padrino-admin/access_control.rb
  2. +20 −0 padrino-admin/test/test_admin_application.rb
@@ -13,7 +13,7 @@ class << self
# Method used by Padrino::Application when we register the extension
#
def registered(app)
app.set :session_id, "_padrino_#{File.basename(Padrino.root)}_#{app.app_name}".to_sym
app.set :session_id, "_padrino_#{File.basename(Padrino.root)}_#{app.app_name}".to_sym unless app.respond_to?(:session_id)
app.set :admin_model, 'Account' unless app.respond_to?(:admin_model)
app.helpers Padrino::Admin::Helpers::AuthenticationHelpers
app.helpers Padrino::Admin::Helpers::ViewHelpers
@@ -6,6 +6,26 @@ def setup
load_fixture 'data_mapper'
end

describe "session id setting" do
it "should provide it if it doesn't exist" do
mock_app do
register Padrino::Admin::AccessControl
end

assert_equal @app.session_id, "_padrino_#{File.basename(Padrino.root)}_#{@app.app_name}".to_sym
end

# it "should preserve it if it already existed" do
# Padrino.configure_apps { enable :sessions; set :session_id, "foo" }

# mock_app do
# register Padrino::Admin::AccessControl
# end

# assert_equal @app.session_id, "foo"
# end
end

it 'should require correctly login' do
mock_app do
register Padrino::Admin::AccessControl

0 comments on commit 6228bcc

Please sign in to comment.
You can’t perform that action at this time.