Actions
Defect #18665
closedInternal Server Error when adding user to group where he is already assigned
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
I have tried via python-redmine adding user to group where he is already assigned and instead of standard exception I have got server error, see log below:
> production.log <Started GET "/users.json?limit=100&name=tester2%40erigones.com&key=ef843075a7a98e8ec902acbc654c86fe33ff3c3d&offset=0" for 127.0.0.1 at 2014-12-17 09:58:28 +0000
Processing by UsersController#index as JSON
Parameters: {"limit"=>"100", "name"=>"tester2@erigones.com", "key"=>"ef843075a7a98e8ec902acbc654c86fe33ff3c3d", "offset"=>"0"}
Current user: admin (id=1)
Rendered users/index.api.rsb (4.1ms)
Completed 200 OK in 10.9ms (Views: 3.7ms | ActiveRecord: 2.8ms)
Started GET "/roles.json?limit=100&key=ef843075a7a98e8ec902acbc654c86fe33ff3c3d&offset=0" for 127.0.0.1 at 2014-12-17 09:58:28 +0000
Processing by RolesController#index as JSON
Parameters: {"limit"=>"100", "key"=>"ef843075a7a98e8ec902acbc654c86fe33ff3c3d", "offset"=>"0"}
Current user: admin (id=1)
Rendered roles/index.api.rsb (0.4ms)
Completed 200 OK in 6.7ms (Views: 1.8ms | ActiveRecord: 1.2ms)
Started GET "/projects/283f42764da6dba2522412916b031080.json?limit=100&key=ef843075a7a98e8ec902acbc654c86fe33ff3c3d&offset=0" for 127.0.0.1 at 2014-12-17 09:58:29 +0000
Processing by ProjectsController#show as JSON
Parameters: {"limit"=>"100", "key"=>"ef843075a7a98e8ec902acbc654c86fe33ff3c3d", "offset"=>"0", "id"=>"283f42764da6dba2522412916b031080"}
Current user: admin (id=1)
Rendered projects/show.api.rsb (4.1ms)
Completed 200 OK in 28.2ms (Views: 3.8ms | ActiveRecord: 7.7ms)
Started POST "/projects/1/memberships.json?key=ef843075a7a98e8ec902acbc654c86fe33ff3c3d" for 127.0.0.1 at 2014-12-17 09:58:29 +0000
Processing by MembersController#create as JSON
Parameters: {"membership"=>{"role_ids"=>[5], "user_id"=>11}, "key"=>"ef843075a7a98e8ec902acbc654c86fe33ff3c3d", "project_id"=>"1"}
Current user: admin (id=1)
Rendered common/error_messages.api.rsb (0.2ms)
Completed 422 Unprocessable Entity in 14.1ms (Views: 0.7ms | ActiveRecord: 2.7ms)
Started GET "/groups.json?limit=100&key=ef843075a7a98e8ec902acbc654c86fe33ff3c3d&offset=0" for 127.0.0.1 at 2014-12-17 09:58:29 +0000
Processing by GroupsController#index as JSON
Parameters: {"limit"=>"100", "key"=>"ef843075a7a98e8ec902acbc654c86fe33ff3c3d", "offset"=>"0"}
Current user: admin (id=1)
Rendered groups/index.api.rsb (1.5ms)
Completed 200 OK in 7.3ms (Views: 1.6ms | ActiveRecord: 1.7ms)
Started POST "/groups/8/users.json?key=ef843075a7a98e8ec902acbc654c86fe33ff3c3d" for 127.0.0.1 at 2014-12-17 09:58:29 +0000
Processing by GroupsController#add_users as JSON
Parameters: {"user_id"=>11, "key"=>"ef843075a7a98e8ec902acbc654c86fe33ff3c3d", "id"=>"8"}
Current user: admin (id=1)
Completed 500 Internal Server Error in 7.2ms
ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "groups_users_ids"
DETAIL: Key (group_id, user_id)=(8, 11) already exists.
: INSERT INTO "groups_users" ("group_id", "user_id") VALUES (8, 11)):
app/controllers/groups_controller.rb:99:in `add_users'
- PostgreSQL 9.3
- ruby 2.1.4p265
- rails (4.1.8, 3.2.19, 3.2.0)
Updated by Jean-Philippe Lang almost 10 years ago
- Status changed from New to Resolved
- Assignee set to Jean-Philippe Lang
- Target version set to 2.6.1
- Resolution set to Fixed
Fixed in r13785, thanks for reporting this.
Updated by Jean-Philippe Lang almost 10 years ago
- Status changed from Resolved to Closed
Actions