User.php: This seems to fix bug 91

Fatal error: Call to a member function get() on a non-object in User.php on line 90
https://github.com/jeromeschneider/Baikal/issues/91

however, I don't know whether this breaks anything.
It seems to work well enough for me.


Former-commit-id: 9818e4fdbf
This commit is contained in:
Tobias Mueller 2014-09-11 21:33:59 +02:00
parent 9d1d7adba6
commit 5e2fee71b8

View file

@ -87,7 +87,11 @@ class User extends \Flake\Core\Model\Db {
$sRes = parent::get($sPropName);
} catch(\Exception $e) {
# no, it may belong to the oIdentityPrincipal model object
$sRes = $this->oIdentityPrincipal->get($sPropName);
if ($this->oIdentityPrincipal) {
$sRes = $this->oIdentityPrincipal->get($sPropName);
} else {
$sRes = "";
}
}
return $sRes;
@ -113,7 +117,9 @@ class User extends \Flake\Core\Model\Db {
parent::set($sPropName, $sPropValue);
} catch(\Exception $e) {
# no, it may belong to the oIdentityPrincipal model object
$this->oIdentityPrincipal->set($sPropName, $sPropValue);
if ($this->oIdentityPrincipal) {
$this->oIdentityPrincipal->set($sPropName, $sPropValue);
}
}
return $this;
@ -277,4 +283,4 @@ class User extends \Flake\Core\Model\Db {
public function getPasswordHashForPassword($sPassword) {
return md5($this->get("username") . ':' . BAIKAL_AUTH_REALM . ':' . $sPassword);
}
}
}