-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3193 from digitalfabrik/feature/zammad-webhook-token
Zammad: remove unique URL & add webhook token
- Loading branch information
Showing
8 changed files
with
130 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,6 +143,7 @@ | |
"integreat_chat_enabled": true, | ||
"zammad_url": "https://zammad.example.com", | ||
"zammad_access_token": "dummytoken", | ||
"zammad_webhook_token": "07cce1d7-ec79-4ae3-98cf-04d340ae6655", | ||
"zammad_chat_handlers": "[email protected]", | ||
"chat_beta_tester_percentage": 50, | ||
"offers": [3, 2, 1, 5] | ||
|
@@ -194,8 +195,9 @@ | |
"machine_translate_events": 1, | ||
"machine_translate_pois": 1, | ||
"integreat_chat_enabled": false, | ||
"zammad_url": null, | ||
"zammad_url": "", | ||
"zammad_access_token": "", | ||
"zammad_webhook_token": "eaea8b88-5f17-4d55-b04c-face1264ca45", | ||
"zammad_chat_handlers": "", | ||
"chat_beta_tester_percentage": 0, | ||
"offers": [3, 4, 2] | ||
|
@@ -247,8 +249,9 @@ | |
"machine_translate_events": 1, | ||
"machine_translate_pois": 1, | ||
"integreat_chat_enabled": false, | ||
"zammad_url": null, | ||
"zammad_url": "", | ||
"zammad_access_token": "", | ||
"zammad_webhook_token": "bf21d6b8-0dcf-4ac9-ba00-1befac1ee25a", | ||
"zammad_chat_handlers": "", | ||
"chat_beta_tester_percentage": 0, | ||
"offers": [] | ||
|
@@ -300,8 +303,9 @@ | |
"machine_translate_events": 1, | ||
"machine_translate_pois": 1, | ||
"integreat_chat_enabled": false, | ||
"zammad_url": null, | ||
"zammad_url": "", | ||
"zammad_access_token": "", | ||
"zammad_webhook_token": "4f130b2e-b85e-4a0e-8a31-63591adb6b3c", | ||
"zammad_chat_handlers": "", | ||
"chat_beta_tester_percentage": 0, | ||
"offers": [] | ||
|
@@ -353,8 +357,9 @@ | |
"machine_translate_events": 1, | ||
"machine_translate_pois": 1, | ||
"integreat_chat_enabled": false, | ||
"zammad_url": null, | ||
"zammad_url": "", | ||
"zammad_access_token": "", | ||
"zammad_webhook_token": "9de4a0be-c394-44a3-8e35-434c5325d8af", | ||
"zammad_chat_handlers": "", | ||
"chat_beta_tester_percentage": 0, | ||
"offers": [1] | ||
|
@@ -406,8 +411,9 @@ | |
"machine_translate_events": 1, | ||
"machine_translate_pois": 1, | ||
"integreat_chat_enabled": false, | ||
"zammad_url": null, | ||
"zammad_url": "", | ||
"zammad_access_token": "", | ||
"zammad_webhook_token": "249bdf60-511d-45a4-a4df-d3b6feca26a1", | ||
"zammad_chat_handlers": "", | ||
"chat_beta_tester_percentage": 0, | ||
"offers": [] | ||
|
@@ -459,8 +465,9 @@ | |
"machine_translate_events": 1, | ||
"machine_translate_pois": 1, | ||
"integreat_chat_enabled": false, | ||
"zammad_url": null, | ||
"zammad_url": "", | ||
"zammad_access_token": "", | ||
"zammad_webhook_token": "ef0a7824-1516-45e2-b878-e1ad5a34b70b", | ||
"zammad_chat_handlers": "", | ||
"chat_beta_tester_percentage": 0, | ||
"offers": [] | ||
|
@@ -512,8 +519,9 @@ | |
"machine_translate_events": 1, | ||
"machine_translate_pois": 1, | ||
"integreat_chat_enabled": false, | ||
"zammad_url": null, | ||
"zammad_url": "", | ||
"zammad_access_token": "", | ||
"zammad_webhook_token": "1a6940d4-9114-470a-9077-42db05037511", | ||
"zammad_chat_handlers": "", | ||
"chat_beta_tester_percentage": 0, | ||
"offers": [] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
integreat_cms/cms/migrations/0110_region_zammad_webhook_token_alter_region_zammad_url.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Generated by Django 4.2.13 on 2024-11-08 12:41 | ||
|
||
import uuid | ||
from typing import Callable | ||
|
||
from django.apps.registry import Apps | ||
from django.db import migrations, models | ||
|
||
|
||
def set_zammad_urls( | ||
apps: Apps, schema_editor: Callable # pylint: disable=unused-argument | ||
) -> None: | ||
""" | ||
Update empty Zammad URLs to Null | ||
""" | ||
Region = apps.get_model("cms", "Region") | ||
Region.objects.filter(zammad_url=None).update(zammad_url="") | ||
for region in Region.objects.all(): | ||
region.zammad_webhook_token = uuid.uuid4() | ||
region.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
""" | ||
Remove zammad_url unique constraint, replace Null values with empty strings, remove null=true | ||
""" | ||
|
||
dependencies = [ | ||
("cms", "0109_custom_truncating_char_field"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="region", | ||
name="zammad_webhook_token", | ||
field=models.UUIDField( | ||
blank=True, | ||
default=uuid.uuid4, | ||
help_text="Token used by Zammad webhooks to inform the Integreat CMS about changed tickets. The token has to be appended with a token= GET parameter to the webhook path.", | ||
verbose_name="Token used by Zammad webhook", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="region", | ||
name="zammad_url", | ||
field=models.URLField( | ||
blank=True, | ||
default=None, | ||
help_text="URL pointing to this region's Zammad instance. Setting this enables Zammad form offers.", | ||
max_length=256, | ||
null=True, | ||
verbose_name="Zammad-URL", | ||
), | ||
), | ||
migrations.RunPython(set_zammad_urls), | ||
migrations.AlterField( | ||
model_name="region", | ||
name="zammad_url", | ||
field=models.URLField( | ||
blank=True, | ||
default="", | ||
help_text="URL pointing to this region's Zammad instance. Setting this enables Zammad form offers.", | ||
max_length=256, | ||
verbose_name="Zammad-URL", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
en: Replace unique Zammad URL constraint with Zammad webhook token | ||
de: Ersetze eindeutige Zammad-URL-Bedingung durch Zammad Webhook Token |