Defect #5434

Redmine 0.9.3 - HTTP500 when trying to filter users for adding to a group

Added by Kevin Streit over 7 years ago. Updated about 6 years ago.

Status:ClosedStart date:2010-05-04
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Groups
Target version:-
Resolution:Invalid Affected version:0.9.3

Description

When trying to filter the list of users in the Administration>Groups>"GroupXYZ">Users Tab (via giving some input to the textfield) I get a HTTP 500 (Internal Server Error) in the users list.

The Error trace from the production log is the following: ===========================================================================
Processing GroupsController#autocomplete_for_user (for 134.96.156.201 at 2010-05-04 10:45:12) [POST]
Parameters: {"action"=>"autocomplete_for_user", "authenticity_token"=>"P1p1MaNLcJMckqSU0VvOfogM1ZBxwr6VX28dtPQpUYU=", "id"=>"14", "q"=>"clem", "controller"=>"groups"}

NoMethodError (undefined method `call' for nil:NilClass):
app/controllers/groups_controller.rb:135:in `autocomplete_for_user'
passenger (2.2.11) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
passenger (2.2.11) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:418:in `start_request_handler'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:358:in `handle_spawn_application'
passenger (2.2.11) lib/phusion_passenger/utils.rb:184:in `safe_fork'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:354:in `handle_spawn_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:163:in `start'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:213:in `start'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'

Rendering /opt/redmine-0.9.3/public/500.html (500 Internal Server Error) ===========================================================================

My version information is as follows: ===========================================================================
- Gentoo Linux System (x86_64)
- ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
- rails 2.3.5
- mysql Ver 14.14 Distrib 5.1.44, for pc-linux-gnu (x86_64) using readline 5.1 ===========================================================================


Related issues

Related to Redmine - Defect #4257: Broken support for Principal plugins New 2009-11-20
Related to Redmine - Defect #8932: User.acts_as_customizable and association loading broken ... Closed 2011-07-28

History

#1 Updated by Kevin Streit over 7 years ago

I upgraded to redmine 0.9.4 and the error is still there...

#2 Updated by Jean-Philippe Lang over 7 years ago

  • Assignee set to Jean-Philippe Lang

#3 Updated by Jean-Philippe Lang over 7 years ago

I can not reproduce with a fresh 0.9.4 and have no idea how this error can occur.

#4 Updated by Clemens Hammacher about 7 years ago

If I change line 135 in app/controllers/groups_controller.rb from

@users = User.active.like(params[:q]).find(:all, :limit => 100) - @group.users

to
@users = Principal.active.like(params[:q]).find(:all, :limit => 100) - @group.users

then it seems to work like expected.

The User class doesn't provide the named_scope :like.

#5 Updated by Jean-Baptiste Barth about 7 years ago

  • Status changed from New to Closed
  • Resolution set to Invalid

It should be inherited automatically, but you'll have problems if you have a plugin which overrides/requires/require_dependency's the principal or user class. You should ensure you don't have such a plugin or provide the output of ruby script/about as requested in SubmittingBugs. Anyway, you found a workaround, plus I consider it as a responsibility of plugin developers, so I close the issue. Thanks for the feedback!

#6 Updated by Clemens Hammacher about 7 years ago

the output of "ruby script/about" on my system:

About your application's environment
Ruby version              1.8.7 (x86_64-linux)
RubyGems version          1.3.7
Rack version              1.0
Rails version             2.3.5
Active Record version     2.3.5
Active Resource version   2.3.5
Action Mailer version     2.3.5
Active Support version    2.3.5
Edge Rails revision       unknown
Application root          /opt/redmine-1.0.2
Environment               production
Database adapter          mysql
Database schema version   20100819172912

About your Redmine plugins
Redmine Wiki Extensions plugin   0.2.1
Latex Wiki-macro Plugin          0.0.3
Redmine Gitosis plugin           0.0.5
Redmine Delete Project plugin    0.0.3

Unfortunately I don't know enough ruby to tell why using Principal works, but User doesn't.
I observerd that I don't need the fix when I remove the Gitosis plugin.

#7 Updated by Bart Vanbrabant almost 7 years ago

Clemens Hammacher wrote:

the output of "ruby script/about" on my system:
[...]

Unfortunately I don't know enough ruby to tell why using Principal works, but User doesn't.
I observerd that I don't need the fix when I remove the Gitosis plugin.

What should a plugin do to fix this?

#8 Updated by Jost Mart about 6 years ago

This hit me today in 1.2.1. The code change found in this issue solved it for me.
This works:

@users = Principal.active.like(params[:q]).find(:all, :limit => 100) - @group.users

# ruby script/about
About your application's environment
Ruby version              1.8.7 (x86_64-linux)
RubyGems version          1.3.5
Rack version              1.1.1
Rails version             2.3.11
Active Record version     2.3.11
Active Resource version   2.3.11
Action Mailer version     2.3.11
Active Support version    2.3.11
Edge Rails revision       unknown
Application root          /xxx/redmine-1.2.1
Environment               development
Database adapter          mysql
Database schema version   20110511000000

About your Redmine plugins
Redmine - Ldap Sync   1.1.0

Also available in: Atom PDF