Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIRA.my_permissions() needs a new required permissions parameter #879

Closed
cz-kialo opened this issue Nov 29, 2019 · 12 comments · Fixed by #1472
Closed

JIRA.my_permissions() needs a new required permissions parameter #879

cz-kialo opened this issue Nov 29, 2019 · 12 comments · Fixed by #1472
Labels
bug good first issue New contributors welcome !

Comments

@cz-kialo
Copy link

cz-kialo commented Nov 29, 2019

Describe the bug
/mypermissions endpoint requires list of permissions in latest API version, see https://developer.atlassian.com/cloud/jira/platform/change-notice-get-my-permissions-requires-permissions-query-parameter/

To Reproduce
Steps to reproduce the behavior:

Call the JIRA.my_permissions() method

or

curl -D- -u $JIRA_USER:$JIRA_PWD -X GET https://$JIRA_DOMAIN.atlassian.net/rest/api/2/mypermissions

No Error for (if permission names exist)

curl -D- -u $JIRA_USER:$JIRA_PWD -X GET https://$JIRA_DOMAIN.atlassian.net/rest/api/2/mypermissions?permissions=ADMINISTER,ADMINISTER_PROJECTS

Possible fix:

  def my_permissions(
    self, projectKey=None, projectId=None, issueKey=None, issueId=None
):

should get a new required parameter "permissions".

Expected behavior

Return permissions data

Stack Trace

  File "/Users/xxxxx/.virtualenvs/XXX/lib/python3.7/site-packages/jira/client.py", line 1854, in my_permissions
    return self._get_json('mypermissions', params=params)
  File "/Users/xxxxx/.virtualenvs/XXX/lib/python3.7/site-packages/jira/client.py", line 2549, in _get_json
    r = self._session.get(url, params=params)
  File "/Users/xxxxx/.virtualenvs/XXX/lib/python3.7/site-packages/jira/resilientsession.py", line 151, in get
    return self.__verb('GET', url, **kwargs)
  File "/Users/xxxxx/.virtualenvs/XXX/lib/python3.7/site-packages/jira/resilientsession.py", line 147, in __verb
    raise_on_error(response, verb=verb, **kwargs)
  File "/Users/xxxxx/.virtualenvs/XXX/lib/python3.7/site-packages/jira/resilientsession.py", line 57, in raise_on_error
    r.status_code, error, r.url, request=request, response=r, **kwargs)
jira.exceptions.JIRAError: JiraError HTTP 400 url: https://xxxxx.atlassian.net/rest/api/2/mypermissions
    text: The 'permissions' query parameter is required.
    
    response headers = {'Server': 'AtlassianProxy/1.15.8.1', 'Cache-Control': 'no-cache, no-store, no-transform', 'Content-Type': 'application/json;charset=UTF-8', 'Strict-Transport-Security': 'max-age=315360000; includeSubDomains; preload', [...]}
    response text = {"errorMessages":["The 'permissions' query parameter is required."],"errors":{}}
@codectl
Copy link
Contributor

codectl commented Mar 11, 2020

How come this wasn't solved yet? I have this issue for like 2 months since Jira decided to introduce this breaking change,..

@codectl
Copy link
Contributor

codectl commented Jul 13, 2022

Guys come on, It's been 2 years since this was raised. It's a rather simple fix and yet it's not part of the any new release.

@studioj
Copy link
Collaborator

studioj commented Jul 14, 2022

@rena2damas this package is fully maintained by volunteers who spend some of their precious free time to refactor/extend or to fix issues they encounter themselves or see fit to take up. This all to improve the general usability of this useful python hook into the Jira RESTApi.
You're free to open a PR to contribute to this package if this is such a pressing issue. Taking into account of course that Jira Server as well as Jira Cloud are still supported.

Please be respectful to those who donate their spare time. You can encourage people to have a look at your specific problem but do that in a friendly manner.

Thank you!

@studioj studioj added bug good first issue New contributors welcome ! labels Jul 14, 2022
@codectl
Copy link
Contributor

codectl commented Jul 14, 2022

Hi @studioj I'm sorry about my tone . I didn't meant it to be disrespectful. I appreciate the effort and this project is very useful to the community reason why I find strange that a breaking change was left unfixed for a while. But well, if PRs are being accepted then I can help with this one.

Thank you and sorry again , looking back I know my approach wasn't the right one .

@studioj
Copy link
Collaborator

studioj commented Jul 14, 2022

No worries, quite a lot of time and effort was spent getting the CI system up and running (and is still being spent)

Trying to get this package to adhere to latest development standards, making it easier for contributors to contribute AND making it more user friendly for end users is the main priority.

If we then feel like doing more and have spare time left we try to look for issues we can fix (of course those who we encounter ourselves or we feel confident to fix without causing regressions will get priority).

I hope your experience opening a PR is pleasant, although there is still a lot of work to do. (do know a year back it was just plainly not possible to fix an issue and release it without knowing you'd cause a lot of regressions which is why releases were not happening properly for a time)

@codectl
Copy link
Contributor

codectl commented Jul 14, 2022

Right , I will give a go with the PR while complying with the PR guidelines.

I have also put some effort into CI within my projects and interestingly enough also moving to latest tools like tox and poetry. I now had the chance to take a look at the CI configs there in the project and might reuse some stuff there. Some of workflows I didn't get the purpose, will have to reread and see what they are used for.

@studioj
Copy link
Collaborator

studioj commented Jul 14, 2022

That could be nice. @adehad is having the best overall view on the CI system... So changes for sure will need his approval :-)
I'd suggest if you see improvements possible to open them as a separate PR. So your bugfix would not be impacted by possible discussion on CI.

As a software tester I encourage you to add a test which validates your fix.

Looking forward to your contribution

@codectl
Copy link
Contributor

codectl commented Jul 14, 2022

For sure not, I think the CI in this project is more advanced and complex than mine , I didn't mean to suggest that I have any meaningful contribution to do there . I'll stick with the API fix only for now :)

and yes I'll ensure the tests cover any changes made . I'll also take a look at the framework being done there. I saw a containerized jira server being started which suggests some integration test suite running on each commit stage , which if that is the case, it's a really interesting approach ;)

@adehad
Copy link
Contributor

adehad commented Jul 26, 2022

@rena2damas feel free to reach out if anything is unclear, the tests can be quite overwhelming, we've tried to improve the approachability, but completely understand if it is daunting.

On a separate note, I can strongly recommend looking into: https://github.com/pypa/hatch if you are also considering poetry and tox

@codectl
Copy link
Contributor

codectl commented Aug 23, 2022

PR #1472 created for this: cloud tests are failing due to a known error on the TestManager component

@adehad
Copy link
Contributor

adehad commented Aug 23, 2022

Awesome, don't worry about the cloud tests for now, it is related to the sharing of secrets that doesn't work for pull requests. I'll see if I can test those and then get back to you

@codectl
Copy link
Contributor

codectl commented Aug 23, 2022

Ah ok , is that so ? I did add some tests that are specific to cloud but I had to use my own cloud credentials to evaluate what is the expected behaviour on a cloud environment.

As for the tests, I can tell you in advance that I had to separate test classes into MyPermissionsServerTests and MyPermissionsCloudTests since Jira introduced a required field permissions that is specific to the cloud only (therefore not applicable to server instances).

codectl added a commit to codectl/jira that referenced this issue Aug 23, 2022
…ithub.com:rena2damas/jira into fix/pycontribs#879-my_permissions-needs-new-param
codectl added a commit to codectl/jira that referenced this issue Aug 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue New contributors welcome !
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants