Skip to content

[Jira] In version 3.14.1 assign_user does not work for cloud version #864

Closed
@sebastianberm

Description

@sebastianberm

It seems like the PR's #821 fixed everything for Jira Server users.
However, I had to change this back for our Jira cloud instance with GDPR strict settings enabled.

Jira Server docs: https://docs.atlassian.com/software/jira/docs/api/REST/8.5.0/#api/2/issue-assign
Jira Cloud docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-assignee-put

So this could be fixed by using the cloud boolean to figure out what you're connecting to.

It seems to be working if I refactor the assign_issue function like so:

    def assign_issue(self, issue, account_id=None):
        """Assign an issue to a user. None will set it to unassigned. -1 will set it to Automatic.
        :param issue: the issue ID or key to assign
        :type issue: int or str
        :param account_id: the account ID of the user to assign the issue to
        :type account_id: str
        :rtype: bool
        """
        base_url = self.resource_url("issue")
        url = "{base_url}/{issue}/assignee".format(base_url=base_url, issue=issue)
        if self.cloud:
            data = {"accountId": account_id}
        else:
            data = {"name": account_id}
        return self.put(url, data=data)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions