mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Handle rare case where user instance has no name assigned
This commit is contained in:
parent
772d3fa67d
commit
40e5536300
@ -216,7 +216,10 @@ class RuleSet(models.Model):
|
||||
return True
|
||||
|
||||
# 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
|
||||
|
||||
@staticmethod
|
||||
|
Loading…
Reference in New Issue
Block a user