isUserAssignable

    Signature

    Helper nodeHelper
    Signature isUserAssignable (projectKey String, user IHubUser/ accountId String)
    Description

    Returns a Boolean value depending on whether the user has the required permissions to be assigned issues of a specific project. In simple words, to check if you can put a given user in the assignee field or not.

    Usually used to avoid errors when syncing users between instances.

    Introduced in 4.6

    Example use

    Set the issue assignee to the remote assignee only if it can be assigned in that project.

    def assignee = nodeHelper.getUserByEmail(replica.assignee?.email)
    if(nodeHelper.isUserAssignable(issue.projectKey, assignee)){
        issue.assignee = assignee
    }else{
        issue.assignee = nodeHelper.getUserByEmail("default@admin.com")
    }

    Set the issue assignee to the remote assignee only if it can be assigned in that project.

    def remoteAssignee = nodeHelper.getUserByEmail(replica.assignee.email)
    if (nodeHelper.isUserAssignable("TEST", remoteAssignee) {
         issue.assignee = remoteAssignee
    }