mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-06 23:32:47 +01:00
refactor: remove pocketbase (#1138)
This commit is contained in:
21
app/data/scripts/assigntickets.py
Normal file
21
app/data/scripts/assigntickets.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import sys
|
||||
import json
|
||||
import random
|
||||
import os
|
||||
|
||||
import requests
|
||||
|
||||
# Parse the ticket from the input
|
||||
ticket = json.loads(sys.argv[1])
|
||||
|
||||
url = os.environ["CATALYST_APP_URL"]
|
||||
header = {"Authorization": "Bearer " + os.environ["CATALYST_TOKEN"]}
|
||||
|
||||
# Get a random user
|
||||
users = requests.get(url + "/api/users", headers=header).json()
|
||||
random_user = random.choice(users)
|
||||
|
||||
# Assign the ticket to the random user
|
||||
requests.patch(url + "/api/tickets/" + ticket["record"]["id"], headers=header, json={
|
||||
"owner": random_user["id"]
|
||||
})
|
||||
Reference in New Issue
Block a user