atlassian-python-api icon indicating copy to clipboard operation
atlassian-python-api copied to clipboard

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

Open sebastianberm opened this issue 3 years ago • 4 comments

It seems like the PR's https://github.com/atlassian-api/atlassian-python-api/pull/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)

sebastianberm avatar Oct 07 '21 14:10 sebastianberm

this is great as you tested it works for cloud and very much required too. Whats holding you back to place this in the repository ? any issues please post here or connect on this project discord chat.

isaac-philip avatar Oct 10 '21 16:10 isaac-philip

Mostly the amount of time I had left for that particular project. Will try to create a PR for it later today, furthermore, I don't have time to create tests for this, so if it can be merged without tests, I'll file it later this week 👍

sebastianberm avatar Oct 11 '21 08:10 sebastianberm

I see similar issue #774 filed long back. maybe we need a better solution which can reflect at all cloud dependent functions.

setting this at the class level object would be better so can be used at other dependencies as well. this is what i am theoretically saying and would need to inspect it, but feel free to go in that direction.

isaac-philip avatar Oct 13 '21 17:10 isaac-philip

@isaac-philip is this actual ?

gonchik avatar Aug 27 '23 18:08 gonchik