Merge pull request #869 from alligatorbait/0.2.x

Verify ticket.assigned_to is set before attempting to access id property
This commit is contained in:
Garret Wassermann 2020-10-08 01:26:10 -04:00 committed by GitHub
commit 720860fe54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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