OCA / connector-jira

GNU Affero General Public License v3.0
21 stars 43 forks source link

The query parameter 'username' is not supported in GDPR strict mode #43

Closed leonelfolmer closed 1 year ago

leonelfolmer commented 4 years ago

Hi guys. I've had some trouble trying to import users, looks like Jira not support that query anymore.

Someone already had these issue?


Traceback (most recent call last):
  File "/odoo/odoo-server/odoo/http.py", line 656, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/odoo/odoo-server/odoo/http.py", line 314, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/odoo/odoo-server/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/odoo/odoo-server/odoo/http.py", line 698, in dispatch
    result = self._call_function(**self.params)
  File "/odoo/odoo-server/odoo/http.py", line 346, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/odoo/odoo-server/odoo/service/model.py", line 98, in wrapper
    return f(dbname, *args, **kwargs)
  File "/odoo/odoo-server/odoo/http.py", line 339, in checked_call
    result = self.endpoint(*a, **kw)
  File "/odoo/odoo-server/odoo/http.py", line 941, in __call__
    return self.method(*args, **kw)
  File "/odoo/odoo-server/odoo/http.py", line 519, in response_wrap
    response = f(*args, **kw)
  File "/odoo/odoo-server/addons/web/controllers/main.py", line 966, in call_button
    action = self._call_kw(model, method, args, {})
  File "/odoo/odoo-server/addons/web/controllers/main.py", line 954, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/odoo/odoo-server/odoo/api.py", line 759, in call_kw
    return _call_kw_multi(method, model, args, kwargs)
  File "/odoo/odoo-server/odoo/api.py", line 746, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/odoo12_addon_connector_jira-12.0.1.6.2-py3.6.egg/odoo/addons/connector_jira/models/jira_backend/common.py", line 531, in import_res_users
    result = self.env['res.users'].search([]).link_with_jira(backends=self)
  File "/usr/local/lib/python3.6/dist-packages/odoo12_addon_connector_jira-12.0.1.6.2-py3.6.egg/odoo/addons/connector_jira/models/res_users/common.py", line 64, in link_with_jira
    jira_user = adapter.search(fragment=resolve_by_value)
  File "/usr/local/lib/python3.6/dist-packages/odoo12_addon_connector_jira-12.0.1.6.2-py3.6.egg/odoo/addons/connector_jira/models/res_users/common.py", line 136, in search
    includeInactive=True)
  File "/usr/local/lib/python3.6/dist-packages/jira/client.py", line 2330, in search_users
    return self._fetch_pages(User, None, 'user/search', startAt, maxResults, params)
  File "/usr/local/lib/python3.6/dist-packages/jira/client.py", line 575, in _fetch_pages
    resource = self._get_json(request_path, params=page_params, base=base)
  File "/usr/local/lib/python3.6/dist-packages/jira/client.py", line 2549, in _get_json
    r = self._session.get(url, params=params)
  File "/usr/local/lib/python3.6/dist-packages/jira/resilientsession.py", line 151, in get
    return self.__verb('GET', url, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/jira/resilientsession.py", line 147, in __verb
    raise_on_error(response, verb=verb, **kwargs)
  File "/usr/local/lib/python3.6/dist-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://my_jira.atlassian.net/rest/api/2/user/search?username=user.name%40domain.com&includeActive=True&includeInactive=True
    text: The query parameter 'username' is not supported in GDPR strict mode.

    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', 'Date': 'Thu, 16 Apr 2020 14:59:19 GMT', 'ATL-TraceId': '87b79ee37648895b', 'X-AREQUESTID': 'f1c8ea1f-57d3-42ea-b0e2-5c650bec3ffd', 'X-AACCOUNTID': '5bfc2e596b98a11ccd361cab', 'X-XSS-Protection': '1; mode=block', 'Transfer-Encoding': 'chunked', 'Timing-Allow-Origin': '*', 'X-Content-Type-Options': 'nosniff', 'Connection': 'close', 'Expect-CT': 'report-uri="https://web-security-reports.services.atlassian.com/expect-ct-report/global-proxy", enforce, max-age=86400'}
    response text = {"errorMessages":["The query parameter 'username' is not supported in GDPR strict mode."],"errors":{}}```
yboujraf commented 3 years ago

Dear @leonelfolmer

I am using cloud version of jira & jira servicedesk & confluence, ...

I have the same issue regarding the username since GDPR.

I found this : https://community.atlassian.com/t5/Advanced-Roadmaps-questions/error-quot-The-query-parameter-username-is-not-supported-in-GDPR/qaq-p/1365942

By 29 April 2019, we will remove personal data from the API that is used to identify users, such as username and userKey, and instead use the Atlassian account ID (accountId). Additionally, will be restricting the visibility of other personal data, such as email, in conjunction with a user's profile privacy settings.

and the migration link : https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/

It will be great if the owner could update the "accountID" instead of "username".

Best Regards

leemannd commented 3 years ago

We are currently not using cloud version of jira. We are not impacted by it for the moment. If anyone is going to work on this, would it be possible to keep a backward compatibility to old api calls?

j-zaballa commented 3 years ago

The Jira Python library has just been updated to accomodate the necessary changes. But it is still not part of any stable release of the library.

Here is the commit.

If anyone is looking to work on this one, first thing would be to help test that versions > 3.0.1 of the library work well with the connector_jira addon.

By the way, the lib changes are backward compatible :).

iledarn commented 2 years ago

It seems there is no way to link users in automatic mode with cloud Jira. There is no emailAddress or Login (username) information anymore in the response, only accoundId photo_2022-01-21_22-31-29 There is displayName which is in my opinion is unreliable to be used for linking

iledarn commented 2 years ago

So I think the only way here - to link users manually or with help of some sort of Identity Provider

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.