I know there exists a function in UserUtil that allows for retrieving the display name from the username I was wondering if a reverse function exists or if it would be possible to code such a function?
Community moderators have prevented the ability to post new answers.
You can use getUsers() from UserUtil to get all user objects and grep the ones with matching display names from the list manually.
this is not quite a good idea for large scaled applications. we have a couple of hundred thousand of users registered in the system. Consider about performance when iterating all of them.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ha Ha! Too funny. Unfortunately, you're not all that right.
It was not deprecated in 5.2.4.1, which is what we use; and seeing
the "Deprecated" compiler directive is now there, meant you were wrong,
and then fixed it. But I'm glad to hear that future releases will be easier
to work with.
And I do respect your abilities, Jamie; so just so I don't sound like a snob,
I am duplicating the method, in the very same package you showed me, us,
everyone, to let you know I'm not smoking something funny. :-)
Found at line 102 of 451 in ChangeHistoryItem.java
public String getUser()
{
return user;
}
Cheers,
Carl
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's ok, it happens.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
;-) no problem.
But in your case getUser returns a string, which should be the user name, not the display name. The methods haven't really changed, just the variable names and the deprecations.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No Jamie. You're WRONG, I say respectfully. Something has gone wrong in your Jira design.
i.e. ChangeHistoryItem the getUser() method returns the display name instead of the userName.
Doh! Right?
Yep. Right.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No sir YOU ARE WRONG. Right? No.
com.atlassian.jira.issue.changehistory.ChangeHistoryItem#getUser
is
@Deprecated public String getUser() { return userKey; }
It returns the user key. Maybe you are thinking of another method.
ChangeHistoryItem contains a value and a string value, maybe you are picking the wrong one.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The fact that you're asking means something has gone wrong somewhere in your design.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
not necessarily. I have a case where i need to fetch multiple users by a part of their full name. Our users have a plugin where they reassign a collection of issues. The usernames in the system are autogenerated and therefore too cryptical. Nobody wants to type random generated strings to fetch some user. Instead they want to write full names and get suggestion options updated while they are typing. So there is a valid use case for fetching users by full name even tho they are not unique. After all, even in case where one single user is required it makes sense to fetch by full name. When multiple users exist whose full names have a match, it can be handled as error case. So Error Message could be displayed: Distinct User Required. One could also provide resolution option for this case, letting the user decide which of multiple matching users he wants to specify.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Display name is not unique username is unique that is the reason there is no such method available in the JIRA API .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok but would it be possible to retrieve a list of all user names corresponding to a particular display name?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
this cannot be the reason for that because there are valid use cases requiring matching multiple users by a part of their full name. In example when you are about to build suggestion options for user picker dropdowns and your users don't like to type the usernames which are often generated and dont say anything to other users.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.