Commit 049ce76a authored by Jo Sama's avatar Jo Sama 😱
Browse files

Set password for operators and persons when CU

parent 90d221a3
import logging
import requests
import uuid
from urllib.parse import urljoin, urlparse
......@@ -107,15 +108,21 @@ class TopDeskClient:
def create_operator(self, operator):
url = self.urls.get_operators()
self.post(url,
return_response=True,
data=operator.json())
# TODO: Remove password setting when proper auth arrives
op = operator.copy()
op.password = uuid.uuid4()
return self.post(url,
return_response=True,
data=op.json())
def update_operator(self, operator):
url = self.urls.get_operator(operator.id)
self.patch(url,
return_response=True,
data=operator.json())
# TODO: Remove password setting when proper auth arrives
op = operator.copy()
op.password = uuid.uuid4()
return self.patch(url,
return_response=True,
data=op.json())
def list_operators(self):
for x in self.get(self.urls.get_operators()):
......@@ -127,15 +134,21 @@ class TopDeskClient:
def create_person(self, person):
url = self.urls.get_persons()
self.post(url,
return_response=True,
data=person.json())
# TODO: Remove password setting when proper auth arrives
pe = person.copy()
pe.password = uuid.uuid4()
return self.post(url,
return_response=True,
data=pe.json())
def update_person(self, person):
url = self.urls.get_person(person.id)
self.patch(url,
return_response=True,
data=person.json())
# TODO: Remove password setting when proper auth arrives
pe = person.copy()
pe.password = uuid.uuid4()
return self.patch(url,
return_response=True,
data=pe.json())
def list_persons(self):
for x in self.get(self.urls.get_persons()):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment