JIRA version: 4.4.3
How does one change the the display name of a User from within a custom service? Javadocs lead me to CrowdService.updateUser. However that method requires a User object and the User object doesn't provide any setters.
Sri
Community moderators have prevented the ability to post new answers.
Sri,
You need to use com.atlassian.crowd.model.user.UserTemplate
Here is the example code: I'm assuming you already injected crowdService.
UserManager userManager = ComponentAccessor.getUserManager(); com.atlassian.crowd.embedded.api.User user = userManager.getUser("admin"); UserTemplate userTemplate = new UserTemplate(user); userTemplate.setDisplayName("A.D. Mean"); try { crowdService.updateUser(userTemplate); } catch (Exception e) { //Handle exceptions properly. e.printStackTrace(); }
Hope this helps,
Raju
Maybe use getUser method to get the User object given the name?
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.