Require API token on printer report

This commit is contained in:
Tanner Collin 2023-06-14 21:48:14 +00:00
parent 3f40545712
commit 4162e4a55d
2 changed files with 9 additions and 3 deletions

View File

@ -1484,9 +1484,9 @@ class ProtocoinViewSet(Base):
def printer_report(self, request, pk=None): def printer_report(self, request, pk=None):
try: try:
with transaction.atomic(): with transaction.atomic():
#auth_token = request.META.get('HTTP_AUTHORIZATION', '') auth_token = request.META.get('HTTP_AUTHORIZATION', '')
#if secrets.VEND_API_TOKEN and auth_token != 'Bearer ' + secrets.VEND_API_TOKEN: if secrets.VEND_API_TOKEN and auth_token != 'Bearer ' + secrets.PRINTER_API_TOKEN:
# raise exceptions.PermissionDenied() raise exceptions.PermissionDenied()
# {'job_name': 'download.png', 'uuid': '6abbad4d-dda3-4954-b4f1-ac77933a0562', 'timestamp': '20230211173624', # {'job_name': 'download.png', 'uuid': '6abbad4d-dda3-4954-b4f1-ac77933a0562', 'timestamp': '20230211173624',
# 'job_status': '0', 'user_name': 'Tanner.Collin', 'source': '1', 'paper_name': 'Plain Paper', 'paper_sqi': '356', 'ink_ul': '54'} # 'job_status': '0', 'user_name': 'Tanner.Collin', 'source': '1', 'paper_name': 'Plain Paper', 'paper_sqi': '356', 'ink_ul': '54'}

View File

@ -62,6 +62,12 @@ DOOR_API_TOKEN = ''
# head /dev/urandom | base32 | head -c 40 # head /dev/urandom | base32 | head -c 40
VEND_API_TOKEN = '' VEND_API_TOKEN = ''
# Vending machine cards API token
# Set this to random characters
# For example, use the output of this:
# head /dev/urandom | base32 | head -c 40
PRINTER_API_TOKEN = ''
# Pinball machine score API token # Pinball machine score API token
# Set this to random characters # Set this to random characters
# For example, use the output of this: # For example, use the output of this: