Project

General

Profile

Actions

Defect #23916

closed

User not initialized before logged in or profile opened

Added by Marc Vollmer over 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
High
Assignee:
-
Category:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

Hello,

we are currently migrating our company to redmine.
Since we don't want to manage users in redmine we added LDAP Auth (and SingleSignOn).
Additionally we installed the LDAP Synchronize plugin to add all users and groups to redmine.

Most of our users won't use redmine directly. They are using one of our programs connecting to the API.

We are currently writing a program to migrate all of our old tickets from another software to redmine.

This software fetches the tickets from the old system and creates them in redmine.
To create the ticket we impersonate to the user (it's a java program so we are using this lib: https://github.com/taskadapter/redmine-java-api and call setOnBehalfOfUser on the Manager), so the author will be correct.

Most of the users haven't login to redmine yet and most never will.
When the migration software hits one of this users and calls createIssue it gets an Error 500.
The production log shows this:

Started POST "/issues.json?include=attachments" for 172.29.121.136 at 2016-09-23 16:11:08 +0200
Processing by IssuesController#create as JSON
  Parameters: {"issue"=>{"subject"=>"XXX", "spent_hours"=>0, "assigned_to_id"=>151, "priority_id"=>10, "project_id"=>7, "author_id"=>98, "due_date"=>"2012-03-07", "tracker_id"=>1, "description"=>"XXX", "created_on"=>"2012/03/07 10:07:00 +0100", "status_id"=>8, "custom_field_values"=>{"1"=>"XXX", "2"=>"XXX", "3"=>"XXX", "4"=>"", "5"=>"2012-04-26", "6"=>"XXX", "7"=>"XXX", "8"=>"318", "11"=>""}}, "include"=>"attachments"}
  User switched by: admin (id=1)
  Current user: some_user (id=98)
Completed 500 Internal Server Error in 93ms (ActiveRecord: 59.2ms)

NoMethodError (undefined method `favourite_project_id' for nil:NilClass):
  plugins/a_common_libs/lib/a_common_libs/user_patch.rb:9:in `favourite_project'
  plugins/a_common_libs/lib/a_common_libs/issue_patch.rb:16:in `allowed_target_projects_with_acl'
  app/models/issue.rb:1384:in `allowed_target_projects'
  app/models/issue.rb:499:in `safe_attributes='
  app/controllers/issues_controller.rb:474:in `build_new_issue_from_params'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

When I now open the profile of the user it works. So when logging in or opening the users profile it seems to be initialized.

The problem is:
Neither now in our test environment nor in production can I open all profiles (multiple hundreds). Even if I write a script to automate it, it would just be for the initial users.
When a new user is created in the ActiveDirectory and is synced to redmine the same will happen (if I wrote earlier: most users won't use redmine directly and the program they are using does the same as the migration tool).

Is there any way to solve this?

Our current planned workaround for the migration tool would be to create the issue with our admin user and update the creator directly in the database (we have to update the created_on field anyway since we cant set it over the api).

But this would be no solution for the production environment after the migration. I don't want to open a connection to the database from the client software.

Thanks for your Help!

Actions #1

Updated by Marc Vollmer over 8 years ago

Ooops, sorry. I just saw that the error occours in "A Common Libs", so I'll report that to RM+.

Actions #2

Updated by Toshi MARUYAMA about 8 years ago

  • Category deleted (REST API)
  • Status changed from New to Closed
  • Resolution set to Invalid
Actions

Also available in: Atom PDF