From b772c6097b724aae3ee2aba69ef73f82e898d518 Mon Sep 17 00:00:00 2001 From: Thomas Weber Date: Tue, 25 Aug 2020 16:11:50 -0600 Subject: [PATCH] Verify ticket.assigned_to is set before attempting to access id property --- helpdesk/views/staff.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index ba7ed16a..0676079a 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -79,7 +79,7 @@ def _has_access_to_queue(user, queue): def _is_my_ticket(user, ticket): """Check to see if the user has permission to access a ticket. If not then deny access.""" - if user.is_superuser or user.is_staff or user.id == ticket.assigned_to.id: + if user.is_superuser or user.is_staff or (ticket.assigned_to and user.id == ticket.assigned_to.id): return True else: return False