mirror of
https://github.com/inventree/InvenTree.git
synced 2026-10-17 07:26:59 +00:00
Handle rare case where user instance has no name assigned
This commit is contained in:
1 parent
772d3fa67d
commit
40e5536300
1 file changed
+4
-1
@@ -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
|
||||
|
||||
Reference in new issue
Block a user