Search code examples
active-directoryredmineaccountsamba

Addming Redmine user fails (email already in use), but no user uses that email


I should note, this user had existed in the past, left, and then came back to be reactivated.

I inherited this Redmine system in the interim, so I don't know all of tis details (read: quirks)

===

When attempting to create the user [email protected], Redmine fails the user add saying The email is already in use.

However a search of Redmine users shows no such user, and can find no such email.

When searching in Redmine for both MY username and my email - both come up, so I think I'm doing the search correctly.

Redmine users are validated against an Samba Active Directory domain (not locally).

The user account seems to be fine in Samba Active Directory.


Solution

  • One user can have multiple e-mail addresses, best way to resolve that situation is to either seek for that user via ruby console or with some SQL database query tool.

    Console approach:

    To activate ruby console, just on your Redmine server, navigate via terminal or cmd on windows to Redmine install folder and type rails console, you might need to add RAILS_ENV=production if required.

    EmailAddress.find_by(address: "[email protected]")
    

    Replace [email protected] with address you are looking for, or

    That would return result like:

    #<EmailAddress id: 3, user_id: 1, address: "[email protected]"...
    

    Than in following query, you can get exact user id, by using user_id from previous query:

    User.find_by(id:id_from_previous_query)
    

    Just replace id_from_previous_query, with proper id, retruned in previous query.

    Database approach:

    E-mail addresses are located in email_addresses database table.

    Below is sql code that you can run if you installed Redmine with MySql/MariaDb, just replace %search% with email or part of email that you are searching for

    select login,firstname,lastname,address from users left join email_addresses on users.id=email_addresses.user_id where email_addresses.address like '%search%'
    

    I have also created feature proposal, based upon your inquiry here: https://www.redmine.org/issues/31043