Hi.
I want to get ApplicationUser in Jira 6.1 by name or by key but I get DelegatingApplicationUser or BridgedDirectoryUser. How I get ApplicationUser?
I try this:
ComponentAccessor.getUserUtil().getUserByKey("key").getClass() ComponentAccessor.getUserUtil().getUserByName("name").getClass() ComponentAccessor.getUserUtil().getUserByKey("key").getDirectoryUser().getClass() ComponentAccessor.getUserUtil().getUserByName("name").getDirectoryUser().getClass( ApplicationUsers.from(ComponentAccessor.getUserUtil().getUserByKey("key").getDirectoryUser()).getClass() ApplicationUsers.from(ComponentAccessor.getUserUtil().getUserByName("name").getDirectoryUser()).getClass()
and i get:
com.atlassian.jira.user.DelegatingApplicationUser com.atlassian.jira.user.DelegatingApplicationUser com.atlassian.jira.user.BridgedDirectoryUser com.atlassian.jira.user.BridgedDirectoryUser com.atlassian.jira.user.DelegatingApplicationUser com.atlassian.jira.user.DelegatingApplicationUser
How I get ApplicationUser?
Thanks
Community moderators have prevented the ability to post new answers.
ApplicationUser is an interface and DelegatingApplicationUser is an implementation, which is what you want to use.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That would be the BridgedDirectoryUser which implements the old crowd User. You can get it from the Application user using getDirectoryUser().
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When I use BridgedDirectoryUser I get
javax.script.ScriptException: java.lang.ClassCastException: com.atlassian.jira.user.BridgedDirectoryUser cannot be cast to com.atlassian.jira.user.ApplicationUser
my code:
def us = ComponentAccessor.getUserUtil().getUserByName("name").getDirectoryUser(); issueManager.updateIssue(us, issue, EventDispatchOption.DO_NOT_DISPATCH, false);
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 updateIssue() expects an ApplicationUser instead of a crowd User. Check the javadocs for the appropriate JIRA version you are developing your plugin for.
Just use one of the examples in your question that return a DelegatingApplicationUser.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We have effectively the same problem. We are trying to call "issueService.validateUpdate(...)", but get an exception "No signature of method... is applicable for argument types" compaining about "com.atlassian.jira.user.BridgedDirectoryUser" type (for which we cannot find any online documentation.
Code:
import com.atlassian.crowd.embedded.api.User import com.atlassian.jira.user.ApplicationUsers ... User loggedInUser = ApplicationUsers.toDirectoryUser(componentManager.jiraAuthenticationContext.user) as User def updateValidationResult = issueService.validateUpdate(loggedInUser, uiip)
Logs:
java.lang.RuntimeException: No signature of method: com.atlassian.jira.bc.issue.DefaultIssueService.validateUpdate() is applicable for argument types: (com.atlassian.jira.user.BridgedDirectoryUser, com.atlassian.jira.issue.IssueInputParametersImpl)... Possible solutions: ... validateCreate(com.atlassian.crowd.embedded.api.User, com.atlassian.jira.issue.IssueInputParameters)
-Johnny
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
For the record, my particular issue got resolved.
Basically, we did not notice that the "Possible solutions" was actually recommending a different method entirely, namely "validateCreate". "validateUpdate" now always takes the ID of the issue you are updating, which we were not passing as an arg in our call.
-Johnny
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
why doesnt updateIssue method accept DelegatingApplicationUser as input parameter?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I use DelegatingApplicationUser and I get:
The script failed : javax.script.ScriptException: javax.script.ScriptException: groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.managers.DefaultIssueManager.updateIssue() is applicable for argument types: (com.atlassian.jira.user.DelegatingApplicationUser, com.atlassian.jira.issue.IssueImpl, com.atlassian.jira.event.type.EventDispatchOption$EventDispatchOptionImpl, java.lang.Boolean)
Possible solutions: updateIssue(com.atlassian.crowd.embedded.api.User, com.atlassian.jira.issue.MutableIssue, com.atlassian.jira.event.type.EventDispatchOption, boolean)
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.