Hello everyone. How to convert Display Name (for example Peter Levicki) to username in Groovy or simply assign by full name?
You can find a user by display name like this. The it varable contains the user.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.user.search.UserSearchService
import com.atlassian.jira.bc.user.search.UserSearchParams
def userSearchService = ComponentAccessor.getComponent(UserSearchService.class);
UserSearchParams userSearchParams = (new UserSearchParams.Builder()).allowEmptyQuery(true).includeActive(true).includeInactive(false).maxResults(100000).build();
userSearchService.findUsers("matveev alexey", userSearchParams).each{ it->
log.error(it.getKey())
}
I know about this method , but I use Jira 6 ( This version not provide UserSearchService module
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Then you need to iterate over all users and find the required user.
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.security.login.LoginManager def loginManager = ComponentAccessor.getComponent(LoginManager.class); ComponentAccessor.getUserManager().getAllUsers().each{ it->
if ("user display name".equals(it.getDisplayName()))
log.error(it.getKey())
}
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.