@@ -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 = '';