2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-29 20:16:44 +00:00

Handle rare case where user instance has no name assigned

This commit is contained in:
Oliver 2021-10-11 21:39:34 +11:00
parent 772d3fa67d
commit 40e5536300

View File

@ -216,7 +216,10 @@ class RuleSet(models.Model):
return True return True
# Print message instead of throwing an error # Print message instead of throwing an error
logger.info(f"User '{user.name}' failed permission check for {table}.{permission}") name = getattr(user, 'name', user.pk)
logger.info(f"User '{name}' failed permission check for {table}.{permission}")
return False return False
@staticmethod @staticmethod