I have various directores associated with JIRA and some user names are duplicated.
UserUtil.getUserObject(String) returns a single user object and there are no overridden methods to send more details like email etc which are distinguishable.
How to handle correct user in this case?
If the email addresses are unique, then why don't you configure the LDAP directory so that the username attribute is pulled from the email address? People can then just login using their email address as the username.
email addresses are unique because they are from different domains
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Spatruni,
As email is one of your distinguishable detail. You can retrive your Jira user by overriding a method getUserByEmail(String email) of class UserUtils.
May be you should try this-
String email = "abc@test.com";
User user = UserUtils.getUserByEmail(email);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Naren,
If i am not wrong, there is no getUserByEmail method in the api. Can you please confirm?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ComponentManager.getInstance().getUserUtil() method returns com.atlassian.jira.user.util. UserUtil object which is not having the above method. Appreciate if you could let me know the way to get the com.atlassian.jira.user.UserUtils object.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There are two classes in Jira. I am using UserUtils api for this, not the UserUtil. The getUserByEmail(String email) is a static method.
Try following code
import com.atlassian.core.user.UserUtils;
import com.atlassian.crowd.embedded.api.User;
User user = null;
String email = "abc@test.com"
try {
user = UserUtils.getUsersByEmail(email);
}
catch(Exception e) {
e.getStackTrace();
}
Hope this answers your query.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for sharing the information. I will try in the above way and check in case of any issues.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Naren, I tried with the above approach, but unfortunately the class and methods are deprecated.
- The type UserUtils is deprecated
- The method getUserByEmail(String) from the type UserUtils is deprecated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Atlassian products don't support duplicate user names.
If you have multiple directories configured for your application, the first directory that contains the referenced username will be considered the canonical account for that username.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Appreciate if you could shower some more information about your answer. I also need the way to handle such usernames likes for example, if i want to move a user from one group to another, i am facing issues.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What kind of issues are you facing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Using the method UserUtil.getUserObject(String), i accessed a user and updated the group. When i searched that user, i found all the users with the same name from other directories vanished.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's because JIRA isn't designed to support multiple users with the same username. How did the duplicate users get created in the first place?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Leaving the passwords blank, providing username, full name and email information since the authentication needs against LDAP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Jira User Name may be duplicated no probs. may be LDAP or Jira User but when user is created for each user we have unique Email ID.
IF we are retriving user by Email id it should fetch only unique users.
jira dont allow same user id for both user names.
user = UserUtils.getUsersByEmail(email);
it should work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried with the above approach, but unfortunately the class and methods are deprecated.
- The type UserUtils is deprecated
- The method getUserByEmail(String) from the type UserUtils is deprecated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Even i need to know how this can be done . i have to merge multiple Jira instances with some common users .. how to deal with duplicate users ? Thank you :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Atlassians,
Any ideas please...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Today only! Share what you’re the most excited about for Team ‘25 or just dance out the beginning of a new quarter with us.
Comment the postOnline forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.