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

[17.0][WIP][MIG] connector_jira: Migration to 17.0 #108

Draft
wants to merge 113 commits into
base: 17.0
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
876fcf8
Add first brick of the connector_jira addon
guewen Nov 15, 2016
c97bb82
Update ir.model.access.csv
damdam-s Jan 10, 2017
fac216a
Set uninstallable
guewen Apr 19, 2017
503ea4f
C2C-152 Add project.task.jira_issue_url
simahawk Nov 20, 2018
1c9f464
add epic and issuetype to analytic line
Dec 13, 2018
ba7bd85
Test jira_key only if connector_no_export is True (#13)
Tonow-c2c Jan 4, 2019
039b16b
Better handling of users sync
simahawk Nov 27, 2018
8e5e7b1
Replace text_field by options
guewen Jan 30, 2019
2e6cfeb
Add connector_jira_servicedesk
p-tombez Jan 29, 2019
ef8e174
Read access tokens with sudo
guewen Feb 1, 2019
62b789b
Apply suggestions from code review
TDu Apr 8, 2019
096827e
Prevent error when linking users
guewen Apr 8, 2019
d12937b
Apply suggestions from code review
TDu Apr 10, 2019
0087734
Fix oldname field
guewen Apr 10, 2019
d221278
Fix psycopg2.ProgrammingError: syntax error when no updated_worklogs …
grindtildeath Apr 25, 2019
3b983b9
Make migration more robust
guewen Apr 8, 2019
002ee9d
Use fallback project when task or project is inactive
jcoux May 22, 2019
2e8ed01
Add base test class for worklog
simahawk May 8, 2019
3341be8
Allow several bindings on projects
guewen Jun 25, 2019
27e0656
[ADD] icon.png
OCA-git-bot Jul 12, 2019
9aff8e4
[MIG] connector_jira: Migration to 12.0
alexey-pelykh Jul 20, 2019
077d338
[IMP] connector_jira: improved user binding
alexey-pelykh Aug 11, 2019
2fba13d
connector_jira 12.0.1.0.1
OCA-git-bot Aug 20, 2019
7b5efb7
[IMP] connector_jira: do not track sync updates
alexey-pelykh Aug 11, 2019
e7fa993
connector_jira 12.0.1.0.2
OCA-git-bot Aug 20, 2019
9376bb5
[IMP] connector_jira: view JIRA keys on project and task views
alexey-pelykh Aug 11, 2019
c1fa545
connector_jira 12.0.1.1.0
OCA-git-bot Aug 23, 2019
4a76bd3
[IMP] connector_jira: restrict linked tasks alteration
alexey-pelykh Aug 11, 2019
bc414aa
[IMP] connector_jira: search by jira keys
alexey-pelykh Aug 24, 2019
278ddfc
connector_jira 12.0.1.2.0
OCA-git-bot Sep 2, 2019
681ac4f
[IMP] connector_jira: import estimation and status for tasks
alexey-pelykh Aug 23, 2019
474a968
[IMP] connector_jira: restrict linked AAL modification
alexey-pelykh Sep 1, 2019
51cd2c5
[FIX] connector_jira: issues can be moved between projects
alexey-pelykh Nov 7, 2019
088a151
[IMP] connector_jira: worklog/timesheet date timezone
alexey-pelykh Nov 8, 2019
057db01
[FIX] connector_jira: UI layout
alexey-pelykh Nov 21, 2019
71e4eb2
connector_jira 12.0.1.4.0
OCA-git-bot Dec 3, 2019
69cae0a
[IMP] connector_jira: write only updated values, validate by cache fo…
alexey-pelykh Dec 4, 2019
53ad6e7
connector_jira 12.0.1.5.0
OCA-git-bot Dec 5, 2019
39299b5
[IMP] connector_jira: forced import option
alexey-pelykh Nov 20, 2019
cba3121
connector_jira 12.0.1.6.0
OCA-git-bot Dec 5, 2019
fb7ac64
[IMP] connector_jira: consider archived employees
alexey-pelykh Feb 13, 2020
0ec6b9b
connector_jira 12.0.1.6.1
OCA-git-bot Feb 14, 2020
47515cf
[FIX][11.0] Remove enterprise related code
jcoux Feb 26, 2020
4cf43e9
connector_jira 12.0.1.6.2
OCA-git-bot Feb 27, 2020
297c64d
[13.0][MIG] connetor_jira: migration
Apr 25, 2020
f6f8e33
[REM] pot file
May 7, 2020
8757139
[IMP] apply black, isort
May 8, 2020
a12f683
connector_jira: Fix _compute_jira_issue_url dependencies
grindtildeath Aug 5, 2020
9d4fb93
connector_jira: Fix inconsistent 'compute_sudo' for computed fields
grindtildeath Aug 5, 2020
675090a
connector_jira: Fix parameter 'oldname' is not longer supported; use …
grindtildeath Aug 5, 2020
9895eeb
connector_jira: Fix view inheritance of project.link.jira
grindtildeath Aug 5, 2020
7f2e40e
connector_jira: Fix display of button in footer on project create form
grindtildeath Aug 5, 2020
a53dc6e
[FIX] remove use of deprecated method
gurneyalex Aug 24, 2020
abba43b
connector_jira: Add epic link on epic
grindtildeath Jul 31, 2020
ce55cdf
Pre-commit fixes
leemannd Jan 20, 2021
30162b5
prettier
leemannd Jan 20, 2021
81ce5cd
Fix missing assignement in compute function
leemannd Mar 8, 2021
dcbc9d7
connector_jira 13.0.1.0.1
OCA-git-bot Mar 11, 2021
e98bade
[FIX] set company_id on the task related to the project
vrenaville Apr 30, 2021
197d848
connector_jira 13.0.1.1.0
OCA-git-bot Jun 15, 2021
1d198a9
[IMP] connector_jira: black, isort, prettier
Jun 1, 2022
2f0c498
[15.0][MIG] connector_jira: Migrate to version 15.0
Jun 8, 2022
0bca123
[UPD] Update connector_jira.pot
Jul 6, 2022
a1ca62d
[UPD] README.rst
OCA-git-bot Jul 6, 2022
fd19196
[UPD] Brainbean Apps => CorporateHub
alexey-pelykh Jul 15, 2022
4ca08be
connector_jira: fix migration from 14.0
sebalix Jul 18, 2022
4e640e4
[15.0][FIX] fix issue with maxResults in url
Jul 14, 2022
5e1cf97
connector_jira 15.0.1.0.1
OCA-git-bot Jul 20, 2022
cc2be69
[UPD] README.rst
OCA-git-bot Jul 20, 2022
b283291
update_contributors
leemannd Jul 20, 2022
847ef40
[UPD] README.rst
OCA-git-bot Jul 20, 2022
a39d923
[UPD] Update connector_jira.pot
Jul 20, 2022
8318b70
[UPD] Brainbean Apps => CorporateHub
alexey-pelykh Nov 4, 2020
493f516
[UPD] README.rst
OCA-git-bot Jul 20, 2022
657f602
[UPD] README.rst
OCA-git-bot Sep 3, 2023
72d7b7e
Fix precommit flagged issues
gurneyalex Feb 7, 2024
fba4c5c
[FIX]: pin python packages dependency requirements
smussie Jan 10, 2024
f9c6857
fixup! fixup! [FIX]: pin python packages dependency requirements
gurneyalex Feb 16, 2024
ba75c16
[DRAFT] 11.0 Make Jira connector GDPR compliant
May 26, 2021
4b02982
[DRAFT] 11.0 Make Jira connector GDPR compliant
May 26, 2021
5357704
[DRAFT] 11.0 Make Jira connector GDPR compliant
May 27, 2021
e09c689
user mapping work
gurneyalex Feb 16, 2024
c97fcaa
update dependencies
gurneyalex Feb 16, 2024
f80832d
fixup! update dependencies
gurneyalex Feb 16, 2024
deb8d4a
fixup! fixup! update dependencies
gurneyalex Feb 16, 2024
ce63608
fixup! user mapping work
gurneyalex Feb 16, 2024
15b3ab9
install the Jira connector as a Jira Connect app
gurneyalex Mar 9, 2024
f9e849f
Design change: urls per jira backend
gurneyalex Mar 10, 2024
5a6bdd4
remove jira_backend_auth wizard
gurneyalex Mar 10, 2024
2a70796
remove jira_oauth_dance CLI tool
gurneyalex Mar 10, 2024
0a85ea0
fixup! remove jira_backend_auth wizard
gurneyalex Mar 10, 2024
89145a2
fixup! Design change: urls per jira backend
gurneyalex Mar 10, 2024
2128cc1
Implement JWT validation on all endpoints
gurneyalex Mar 11, 2024
f131b1d
fix scheduled actions: handle multiple backends
gurneyalex Mar 11, 2024
c5cdc52
update documentation, fix issues, remove tests
gurneyalex Mar 15, 2024
09db602
update documentation, fix issues, remove tests
gurneyalex Mar 15, 2024
9bfbaec
fixup! update documentation, fix issues, remove tests
gurneyalex Mar 15, 2024
6edd215
fixup! fixup! update documentation, fix issues, remove tests
gurneyalex Mar 15, 2024
cd51671
fixup! fixup! fixup! fixup! update documentation, fix issues, remove …
gurneyalex Mar 15, 2024
de2e92a
add migration script
gurneyalex Mar 15, 2024
da42960
fixup! add migration script
gurneyalex Mar 15, 2024
99c89b9
fixup! fixup! add migration script
gurneyalex Mar 16, 2024
c7fe104
add missing dependency on requests-jwt
gurneyalex Mar 16, 2024
94d8b8e
worklog import
gurneyalex Apr 10, 2024
b36c30e
fixup! add missing dependency on requests-jwt
gurneyalex Apr 10, 2024
8c1dcbd
fix migration script
gurneyalex Apr 10, 2024
84cb7d8
improve app description
gurneyalex Apr 10, 2024
25d2feb
Don't use the webhook payload for worklog
gurneyalex Apr 16, 2024
9de84af
Fix 'Link users' button
gurneyalex Apr 19, 2024
62e4a95
fixup! Implement JWT validation on all endpoints
gurneyalex Apr 26, 2024
26bd036
[IMP] connector_jira: pre-commit auto fixes
SilvioC2C Jun 24, 2024
c23c7ed
[ADD] OCA dependencies
SilvioC2C Jun 25, 2024
699a31f
[WIP][MIG] connector_jira: Migration to 17.0
SilvioC2C Jun 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Design change: urls per jira backend
The urls now use the jira backend'id so it is possible to have different
backends installed separately.
  • Loading branch information
gurneyalex authored and SilvioC2C committed Jul 11, 2024

Verified

This commit was signed with the committer’s verified signature.
commit f9e849fa8d1b95a5b2d14a2524b72b81fff8d8ab
106 changes: 63 additions & 43 deletions connector_jira/controllers/main.py
Original file line number Diff line number Diff line change
@@ -41,31 +41,34 @@


class JiraWebhookController(http.Controller):
@http.route("/connector_jira/webhooks/issue", type="json", auth="none", csrf=False)
def webhook_issue(self, issue_id=None, **kw):
@http.route(
"/connector_jira/<int:backend_id>/webhooks/issue",
type="json",
auth="none",
csrf=False,
)
def webhook_issue(self, backend_id, issue_id=None, **kw):
ensure_db()
import pprint

pprint.pprint(request.jsonrequest)
request.uid = odoo.SUPERUSER_ID
env = request.env
backend = env["jira.backend"].search(
[
# ("use_webhooks", "=", True)
],
limit=1,
[("id", "=", backend_id), ("state", "=", "running")]
)
if not backend:
_logger.warning(
"Received a webhook from Jira but cannot find a "
"Jira backend with webhooks activated"
"Received an Issue webhook from Jira for backend %d but cannot find a "
"matching running backend",
backend_id,
)
return

# TODO: check jwt
action = request.jsonrequest["webhookEvent"]

worklog = request.jsonrequest["issue"]
issue_id = worklog["id"]
payload = request.jsonrequest["issue"]
issue_id = payload["id"]

delayable_model = env["jira.project.task"].with_delay()
if action == "jira:issue_deleted":
@@ -74,36 +77,36 @@ def webhook_issue(self, issue_id=None, **kw):
delayable_model.import_record(backend, issue_id)

@http.route(
"/connector_jira/webhooks/worklog", type="json", auth="none", csrf=False
"/connector_jira/<int:backend_id>/webhooks/worklog",
type="json",
auth="none",
csrf=False,
)
def webhook_worklog(self, **kw):
def webhook_worklog(self, backend_id, **kw):
ensure_db()
request.uid = odoo.SUPERUSER_ID
env = request.env
backend = env["jira.backend"].search(
[
# ("use_webhooks", "=", True)
],
limit=1,
[("id", "=", backend_id), ("state", "=", "running")]
)
if not backend:
_logger.warning(
"Received a webhook from Jira but cannot find a "
"Jira backend with webhooks activated"
"Received a Worklog webhook from Jira for backend %d but cannot find a "
"matching runnign backend",
backend_id,
)
return
# TODO: check jwt

action = request.jsonrequest["webhookEvent"]

worklog = request.jsonrequest["worklog"]
issue_id = worklog["issueId"]
worklog_id = worklog["id"]
payload = request.jsonrequest["worklog"]
issue_id = payload["issueId"]
worklog_id = payload["id"]

if action == "worklog_deleted":
env["jira.account.analytic.line"].with_delay(
description=_(
"Delete a local worklog which has " "been deleted on JIRA"
)
description=_("Delete a local worklog which has been deleted on JIRA")
).delete_record(backend, worklog_id)
else:
env["jira.account.analytic.line"].with_delay(
@@ -145,31 +148,36 @@ class JiraConnectAppController(http.Controller):
"""

@http.route(
"/jira/app-descriptor.json",
"/jira/<int:backend_id>/app-descriptor.json",
type="http",
methods=["GET"],
auth="public",
csrf=False,
)
def app_descriptor(self, **kwargs):
def app_descriptor(self, backend_id, **kwargs):
ensure_db()
request.uid = odoo.SUPERUSER_ID
env = request.env

backend = env["jira.backend"] # .search([("use_webhooks", "=", True)], limit=1)
descriptor = backend._get_app_descriptor()
backend = env["jira.backend"].search([("id", "=", backend_id)])
if not backend:
descriptor = {}
else:
descriptor = backend._get_app_descriptor()
mime = "application/json"

body = json.dumps(descriptor)
print(body)
return request.make_response(
body, [("Content-Type", mime), ("Content-Length", len(body))]
)

@http.route(
"/jira/installed", type="json", methods=["POST"], auth="public", csrf=False
"/jira/<int:backend_id>/installed",
type="json",
methods=["POST"],
auth="public",
csrf=False,
) # FIXME: auth management
def install_app(self, **kwargs):
def install_app(self, backend_id, **kwargs):
payload = request.jsonrequest
# TODO use autorization header to validate the request
# See https://developer.atlassian.com/cloud/jira/platform/security-for-connect-apps/#validating-installation-lifecycle-requests
@@ -185,42 +193,54 @@ def install_app(self, **kwargs):
assert payload["eventType"] == "installed"
ensure_db()
env = request.env
backend = env["jira.backend"].sudo()
backend = env["jira.backend"].sudo().browse(backend_id)
backend._install_app(payload)
return {"status": "OK"}

@http.route(
"/jira/uninstalled", type="json", methods=["POST"], auth="public", csrf=False
"/jira/<int:backend_id>/uninstalled",
type="json",
methods=["POST"],
auth="public",
csrf=False,
) # FIXME: auth management
def uninstall_app(self, **kwargs):
def uninstall_app(self, backend_id, **kwargs):
payload = request.jsonrequest
_logger.info("uninstalled: %s", payload)
assert payload["eventType"] == "uninstalled"
env = request.env
backend = env["jira.backend"].sudo()
backend = env["jira.backend"].sudo().browse(backend_id)
response = backend._uninstall_app(payload)
return {"status": response}

@http.route(
"/jira/enabled", type="json", methods=["POST"], auth="public", csrf=False
"/jira/<int:backend_id>/enabled",
type="json",
methods=["POST"],
auth="public",
csrf=False,
)
def enable_app(self, payload=None, **kwargs):
def enable_app(self, backend_id, **kwargs):
payload = request.jsonrequest
_logger.info("enabled: %s", payload)
assert payload["eventType"] == "enabled"
env = request.env
backend = env["jira.backend"].sudo()
response = backend._enable_app(payload)
backend = env["jira.backend"].sudo().browse(backend_id)
return {"status": response}

@http.route(
"/jira/disabled", type="json", methods=["POST"], auth="public", csrf=False
"/jira/<int:backend_id>/disabled",
type="json",
methods=["POST"],
auth="public",
csrf=False,
)
def disable_app(self, payload=None, **kwargs):
def disable_app(self, backend_id, **kwargs):
payload = request.jsonrequest
_logger.info("disabled: %s", payload)
assert payload["eventType"] == "disabled"
env = request.env
backend = env["jira.backend"].sudo()
response = backend._disable_app(payload)
backend = env["jira.backend"].sudo().browse(backend_id)
return {"status": response}
Loading