Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compatibility redmine 2.x #11

Open
Vysserk opened this issue Sep 28, 2012 · 2 comments
Open

compatibility redmine 2.x #11

Vysserk opened this issue Sep 28, 2012 · 2 comments

Comments

@Vysserk
Copy link

Vysserk commented Sep 28, 2012

Hello,

I tried to use this plugin in this environment :
Redmine version 2.0.3.stable
Ruby version 1.8.7 (x86_64-linux)
Rails version 3.2.6

So first I would like to ask if we could have an update of this plugin for redmine 2.x, please ?

Now to help the other users, I will explain how I fixed the problems I encoutered :

4 things to fix.
1) In my environment, the plugin did not load casclient.

I always have the error :
/var/lib/gems/1.8/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require': no such file to load -- casclient (LoadError)

So I copied the content of the repository :
/var/lib/gems/1.8/gems/rubycas-client-2.3.9/lib
in :
${REDMINE_PATH}/plugins/redmine_cas/lib/

2) Another problem :

${REDMINE_PATH}/plugins/ifad-redmine-cas-plugin-c9c0d6a/lib/redmine_cas.rb:155: uninitialized constant ActionController::Dispatcher (NameError)

This is a RAILS 3.x libraries problem, the function "ActionController::Dispatcher" doesn't exist any more.
To fix that, I change in the file "${REDMINE_PATH}/plugins/redmine_cas/lib/redmine_cas.rb :

  • "ActionController::Dispatcher.to_prepare do”
  • by : “Rails.configuration.to_prepare do”

Next to that, we can successfully see the main page of redmine.

But, there are still problems with the "login_without_cas".

3) When the option "login_without_cas" is enabled, the whole redmine become unavailable.

In the logs :

ActionController::RoutingError (No route matches {:controller=>"account", :action=>"login_without_cas"}):
lib/redmine/menu_manager.rb:150:in render_single_menu_node' lib/redmine/menu_manager.rb:102:inrender_menu_node'
lib/redmine/menu_manager.rb:91:in render_menu' lib/redmine/menu_manager.rb:168:inmenu_items_for'
lib/redmine/menu_manager.rb:165:in each' lib/redmine/menu_manager.rb:165:inmenu_items_for'
lib/redmine/menu_manager.rb:90:in render_menu' app/views/layouts/base.html.erb:29:in_app_views_layouts_base_html_erb__776016318_70003952580540'

To fix that, I added a new route in the file "${REDMINE_PATH}/config/routes.rb" :

  • match 'login_without_cas', :to => 'account#login_without_cas'
    (I added it between login et logout)
4) With that, Redmine becomes available but the link "login_without_cas" doesn't work.

Redmin show a "Internal error" page.
In the logs :
ActionView::Template::Error (uninitialized constant ActionView::CompiledTemplates::RAILS_ROOT):
1: <%= render :file => "#{RAILS_ROOT}/app/views/account/login.rhtml" %>
plugins/redmine_cas/app/views/account/login_without_cas.html.erb:1:in `_plugins_redmine_cas_app_views_account_login_without_cas_html_erb___654617792_69995100736760'

By try and error, I discovered that Redmine searches the template "#{RAILS_ROOT}/app/views/account/login.rhtml" in :

  • ${REDMINE_PATH}/plugins/redmine_cas/app/views
  • ${REDMINE_PATH}/app/views
  • ${REDMINE_PATH}
  • /

So it is not important to set "RAILS_ROOT" when a simple modification like below is enough.

{RAILS_ROOT}/app/views/account/login.rhtml -> account/login.html.erb

(login.rhtml has been remplaced by login.html.erb)

Now that works fine :)

@bqh
Copy link

bqh commented Sep 28, 2012

what about the logout ? :)

@vjt
Copy link
Contributor

vjt commented Sep 28, 2012

Hi,

unfortunately we don't have now the resources to update this plugin for redmine 2.x. moreover, we think that a better approach is to use omniauth, as its cas provider works very well and doesn't require the outdated casclient.

as you managed to work around the issues, can you try out omniauth and omniauth-cas, and cook a pull request? we'd be then happy to test it and merge it afterwards.

only, try to avoid copying other libraries files, it's better to require them as dependencies.

thanks,

~Marcello (via iPhone)

~ [email protected]
~ http://sindro.me/
~ http://www.linkedin.com/in/marcellobarnaba

On Sep 28, 2012, at 11:59 AM, Vysserk [email protected] wrote:

Hello,

I tried to use this plugin in this environment :
Redmine version 2.0.3.stable
Ruby version 1.8.7 (x86_64-linux)
Rails version 3.2.6

So first I would like to ask if we could have an update of this plugin for redmine 2.x, please ?

Now to help the other users, I will explain how I fixed the problems I encoutered :

4 things to fix.

  1. In my environment, the plugin did not load casclient.

I always have the error :
/var/lib/gems/1.8/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in `require': no such file to load -- casclient (LoadError)

So I copied the content of the repository :
/var/lib/gems/1.8/gems/rubycas-client-2.3.9/lib
in :
${REDMINE_PATH}/plugins/redmine_cas/lib/

  1. Another problem :

${REDMINE_PATH}/plugins/ifad-redmine-cas-plugin-c9c0d6a/lib/redmine_cas.rb:155: uninitialized constant ActionController::Dispatcher (NameError)

This is a RAILS 3.x libraries problem, the function "ActionController::Dispatcher" doesn't exist any more.
To fix that, I change in the file "${REDMINE_PATH}/plugins/redmine_cas/lib/redmine_cas.rb :

"ActionController::Dispatcher.to_prepare do”
by : “Rails.configuration.to_prepare do”
Next to that, we can successfully see the main page of redmine.

But, there are still problems with the "login_without_cas".

  1. When the option "login_without_cas" is enabled, the whole redmine become unavailable.

In the logs :

ActionController::RoutingError (No route matches {:controller=>"account", :action=>"loginwithout_cas"}):
lib/redmine/menu_manager.rb:150:in render_single_menu_node'
lib/redmine/menu_manager.rb:102:inrender_menu_node'
lib/redmine/menu_manager.rb:91:in render_menu'
lib/redmine/menu_manager.rb:168:inmenu_items_for'
lib/redmine/menu_manager.rb:165:in each'
lib/redmine/menu_manager.rb:165:inmenu_items_for'
lib/redmine/menu_manager.rb:90:in render_menu'
app/views/layouts/base.html.erb:29:in_app_views_layouts_base_html_erb_776016318_70003952580540'

To fix that, I added a new route in the file "${REDMINE_PATH}/config/routes.rb" :

match 'login_without_cas', :to => 'account#login_without_cas' (I added it between login et logout)
4) With that, Redmine becomes available but the link "login_without_cas" doesn't work.

Redmin show a "Internal error" page.
In the logs :
ActionView::Template::Error (uninitialized constant ActionView::CompiledTemplates::RAILSROOT):
1: <%= render :file => "#{RAILS_ROOT}/app/views/account/login.rhtml" %>
plugins/redmine_cas/app/views/account/login_without_cas.html.erb:1:in `_plugins_redmine_cas_app_views_account_login_without_cas_html_erb__654617792_69995100736760'

By try and error, I discovered that Redmine searches the template "#{RAILS_ROOT}/app/views/account/login.rhtml" in :

${REDMINE_PATH}/plugins/redmine_cas/app/views
${REDMINE_PATH}/app/views
${REDMINE_PATH}
/
So it is not important to set "RAILS_ROOT" when a simple modification like below is enough.
#{RAILS_ROOT}/app/views/account/login.rhtml -> account/login.html.erb
(login.rhtml has been remplaced by login.html.erb)

Now that works fine :)


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants