mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 23:42:11 +00:00
check if user passed to setUser() is a real user
This commit is contained in:
parent
0cd4c9b727
commit
9687c8f081
|
@ -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;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user