chrodriguez / redmine_omniauth_saml

Plugins that adds SAML authentication support for "Redmine"
GNU General Public License v2.0
38 stars 57 forks source link

ActionView::Template::Error (undefined method `created_by_omniauth_saml?' for #<User:0x007f10411485e0> #12

Closed gosforth closed 8 years ago

gosforth commented 8 years ago

Looks like plugin is searching for some variable 'change_password_allowed_with_omniauth_saml' and cannot find it. How to sove this?

Started GET "/my/account" for 91.226.197.29 at 2016-08-04 21:33:35 +0200 Processing by MyController#account as HTML Current user: test (id=14) Rendered my/account.html.erb within layouts/base (25.4ms) Completed 500 Internal Server Error in 31ms (ActiveRecord: 1.1ms)

ActionView::Template::Error (undefined method created_by_omniauth_saml?' for #<User:0x007f10411485e0> Did you mean? created_on_was): 1: <div class="contextual"> 2: <%= additional_emails_link(@user) %> 3: <%= link_to(l(:button_change_password), {:action => 'password'}, :class => 'icon icon-passwd') if @user.change_password_allowed? %> 4: <%= call_hook(:view_my_account_contextual, :user => @user)%> 5: </div> 6: plugins/redmine_omniauth_saml/lib/redmine_omniauth_saml/user_patch.rb:26:inchange_password_allowed_with_omniauth_saml?' app/views/my/account.html.erb:3:in _app_views_my_account_html_erb__447364996123502152_69853895474700' lib/redmine/sudo_mode.rb:63:insudo_mode'

chrodriguez commented 8 years ago

Did you run plugin migrations?

gosforth commented 8 years ago

Hi, thanks for reply. I did run RAILS_ENV=production rake redmine:plugin Something else?

gosforth commented 8 years ago

What I can do with this?

chrodriguez commented 8 years ago

Sorry for the delay, what version of redmine are you using?

gosforth commented 8 years ago

OK, understand. The latest one 3.3.0

chrodriguez commented 8 years ago

Did you try lowering to version 3.2 or 3.1?

gosforth commented 8 years ago

No, I did not. You know, lot of work and in addition I do not want to lose features :(

This variable 'change_password_allowed_with_omniauth_saml' (or something) is somewhere in table? Plugin checks some settings and this settings does not exists/ore is not readible? What can be the problem?

chrodriguez commented 8 years ago

I'll try with this release... please be patient

chrodriguez commented 8 years ago

I've installed redmine-3.3-stable and install this plugin using ruby version 2.3.0. I've no problems with it.

Did you install the plugin using git? If not, retry with the latest version

Which version of ruby are you using?

gosforth commented 8 years ago

Environment: Redmine version 3.3.0.stable Ruby version 2.3.0-p0 (2015-12-25) [x86_64-linux] Rails version 4.2.6 Environment production Database adapter Mysql2 SCM: Filesystem
Redmine plugins: redmine_omniauth_saml 0.0.1

How I did install it:

I see the plugin in Redmine, I can enter configuration but what I enter link my/account I have error.

I'm not sure I did run 'bundle install'. It is safe to run it now? I should run it from main redmine-app directory?

I've checked config/routes.rb of my Redmine and I do not see the content of https://github.com/chrodriguez/redmine_omniauth_saml/blob/master/config/routes.rb

gosforth commented 8 years ago

I did run all install command again and now my/account works. I just wonder what will happen if I choose "Replace Redmine login page" option from configuration menu and then I will need access directly to Redmine ( I understand this option redirects to SSO login page)?

chrodriguez commented 8 years ago

That's exactly what it does. You can disable it using the rails console

gosforth commented 8 years ago

In which way? :-)

chrodriguez commented 8 years ago

I've been checking, but this option it doesn do anything at the moment. In case you need to change this setting, you can first run rails console and at the console prompt run the following commands:

irb(main):001:0> setting = Setting.find_by(name: 'plugin_redmine_omniauth_saml')
  Setting Load (57.7ms)  SELECT  `settings`.* FROM `settings` WHERE `settings`.`name` = 'plugin_redmine_omniauth_saml' LIMIT 1
=> #<Setting id: 1, name: "plugin_redmine_omniauth_saml", value: "--- !ruby/hash-with-ivars:ActionController::Parame...", updated_on: "2016-08-08 13:36:33">
irb(main):002:0> setting.value
=> {"enabled"=>"true", "label_login_with_saml"=>"TEST SAML", "onthefly_creation"=>"true"}
irb(main):003:0> setting.value['replace_redmine_login'] = false
=> true
irb(main):004:0> setting.save
   (0.4ms)  BEGIN
   (0.3ms)  COMMIT
=> true
gosforth commented 8 years ago

Thank you!

edgewater9 commented 7 years ago

I am running Redmine 3.4.2, and I had the exactly same problem after installing this plugin. Then the problem went away after the plugin migration by re-running the installation command ("rake redmine:plugins RAILS_ENV=production"). Thanks @gosforth & @chrodriguez !