Browse Source

Fix test on user->id

Laurent Destailleur 2 years ago
parent
commit
09426bd81f
1 changed files with 6 additions and 0 deletions
  1. 6 0
      htdocs/user/class/user.class.php

+ 6 - 0
htdocs/user/class/user.class.php

@@ -835,6 +835,12 @@ class User extends CommonObject
 
 		dol_syslog(get_class($this)."::addrights $rid, $allmodule, $allperms, $entity, $notrigger for user id=".$this->id);
 
+		if (empty($this->id)) {
+			$error++;
+			$this->error = 'Try to call addrights on an object user with an empty id';
+			return -1;
+		}
+
 		$error = 0;
 		$whereforadd = '';