check if user passed to setUser() is a real user

This commit is contained in:
Uwe Steinmann 2021-09-17 18:25:23 +02:00
parent 0cd4c9b727
commit 9687c8f081

View File

@ -593,11 +593,22 @@ class SeedDMS_Core_DMS {
* If user authentication was done externally, this function can
* be used to tell the dms who is currently logged in.
*
* @param object $user
* @param object $user this muss not be empty and an instance of SeedDMS_Core_User
* @return bool|object returns the old user object or null on success, otherwise false
*
*/
function setUser($user) { /* {{{ */
$this->user = $user;
if(!$user) {
$olduser = $this->user;
$this->user = null;
return $olduser;
}
if(is_object($user) && (get_class($user) == $this->getClassname('user'))) {
$olduser = $this->user;
$this->user = $user;
return $olduser;
}
return false;
} /* }}} */
/**