Defect #6457

Edit User group problem

Added by Ferry de Kruyff about 7 years ago. Updated almost 7 years ago.

Status:ClosedStart date:2010-09-21
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Database
Target version:1.0.4
Resolution:Fixed Affected version:1.0.3

Description

Hi,

I get a blank page when i change the user group off a user.

Error log on server:
Processing UsersController#edit (for 80.56.*.* at 2010-09-21 15:16:28) [POST]
Parameters: {"user"=>{"group_ids"=>["20", ""]}, "commit"=>"Save", "action"=>"edit", "authenticity_token"=>"Pt6QH/+A4nYLrKHlzPDsOcj+5AYJtnbxfOHG8f2VYCk=", "id"=>"28", "controller"=>"users"}

ActiveRecord::RecordInvalid (Validation failed: Project can't be blank):
app/models/group.rb:38:in `user_added'
app/models/group.rb:33:in `user_added'
app/models/user.rb:36
app/controllers/users_controller.rb:101:in `edit'


Related issues

Duplicated by Redmine - Defect #7001: adding users to an existing group yeilds an error Closed 2010-11-29

Associated revisions

Revision 4437
Added by Jean-Philippe Lang almost 7 years ago

Prevents validation error when adding a user to a group (#6457).

History

#1 Updated by Ferry de Kruyff about 7 years ago

  • Assignee set to Eric Davis

#2 Updated by Eric Davis about 7 years ago

  • Assignee deleted (Eric Davis)

#3 Updated by Jose Javier Sianes Ruiz about 7 years ago

We have same problem trying to add an existing user to an existing group:

Processing UsersController#edit (for 10.240.193.201 at 2010-10-19 10:47:30) [POST]
  Parameters: {"user"=>{"group_ids"=>["32", ""]}, "commit"=>"Guardar", "action"=>"edit", "authenticity_token"=>"IHXGuXkHfQi7BWfyXtnLqunEY74WuHbWXlkDTMK0Kk4=", "id"=>"104", "controller"=>"users"}

ActiveRecord::RecordInvalid (translation missing: es, activerecord, errors, messages, record_invalid):
  app/models/group.rb:38:in `user_added'
  app/models/group.rb:33:in `user_added'
  app/models/user.rb:36
  app/controllers/users_controller.rb:99:in `edit'
  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'

Using redmine 1.0.1.

#4 Updated by Jose Javier Sianes Ruiz about 7 years ago

Any news about this problem or idea when could be resolved?

#5 Updated by Felix Schäfer about 7 years ago

Have you ever meddled with the DB directly? For example removed a user or something like that?

#6 Updated by Jean-Philippe Lang about 7 years ago

Can you try this patch?

Index: app/models/group.rb
===================================================================
--- app/models/group.rb    (revision 4388)
+++ app/models/group.rb    (working copy)
@@ -31,6 +31,7 @@

   def user_added(user)
     members.each do |member|
+      next if member.project.nil?
       user_member = Member.find_by_project_id_and_user_id(member.project_id, user.id) || Member.new(:project_id => member.project_id, :user_id => user.id)
       member.member_roles.each do |member_role|
         user_member.member_roles << MemberRole.new(:role => member_role.role, :inherited_from => member_role.id)

#7 Updated by Jose Javier Sianes Ruiz almost 7 years ago

  • Status changed from New to Resolved

Great! This patch works out of the box for Redmine 1.0.1. Thanks!

#8 Updated by Jean-Philippe Lang almost 7 years ago

  • Category set to Database
  • Assignee set to Jean-Philippe Lang
  • Target version set to 1.0.4

#9 Updated by Jean-Philippe Lang almost 7 years ago

  • Status changed from Resolved to Closed
  • Affected version (unused) set to 1.0.3
  • Resolution set to Fixed
  • Affected version set to 1.0.3

Fix committed.

Also available in: Atom PDF