本文整理汇总了PHP中Pimcore\Model\User::save方法的典型用法代码示例。如果您正苦于以下问题:PHP User::save方法的具体用法?PHP User::save怎么用?PHP User::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Model\User
的用法示例。
在下文中一共展示了User::save方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: verifyPassword
/**
* @param User $user
* @param $password
* @return bool
*/
public static function verifyPassword($user, $password)
{
$password = self::preparePlainTextPassword($user->getName(), $password);
if ($user->getPassword()) {
// do not allow logins for users without a password
if (password_verify($password, $user->getPassword())) {
if (password_needs_rehash($user->getPassword(), PASSWORD_DEFAULT)) {
$user->setPassword(self::getPasswordHash($user->getName(), $password));
$user->save();
}
return true;
}
}
return false;
}
示例2: setUser
/**
* @param Model\User $user
* @return $this
*/
public function setUser(Model\User $user)
{
$this->user = $user;
\Zend_Registry::set("pimcore_admin_user", $this->user);
$this->setLanguage($this->user->getLanguage());
// update perspective settings
$requestedPerspective = $this->getParam("perspective");
if ($requestedPerspective) {
if ($requestedPerspective != $user->getActivePerspective()) {
$existingPerspectives = array_keys(Config::getPerspectivesConfig()->toArray());
if (!in_array($requestedPerspective, $existingPerspectives)) {
$requestedPerspective = null;
}
}
}
if (!$requestedPerspective) {
$requestedPerspective = $user->getActivePerspective();
}
//TODO check if perspective is still allowed
if ($requestedPerspective != $user->getActivePerspective()) {
$user->setActivePerspective($requestedPerspective);
$user->save();
}
return $this;
}
示例3: setUser
/**
* @param Model\User $user
* @return $this
*/
public function setUser(Model\User $user)
{
$this->user = $user;
\Zend_Registry::set("pimcore_admin_user", $this->user);
$this->setLanguage($this->user->getLanguage());
// update perspective settings
$requestedPerspective = $this->getParam("perspective");
if ($requestedPerspective) {
if ($requestedPerspective != $user->getActivePerspective()) {
$existingPerspectives = array_keys(Config::getPerspectivesConfig()->toArray());
if (!in_array($requestedPerspective, $existingPerspectives)) {
$requestedPerspective = null;
}
}
}
if (!$requestedPerspective || !$user->isAllowed($requestedPerspective, "perspective")) {
//choose active perspective or a first allowed
$requestedPerspective = $user->isAllowed($user->getActivePerspective(), "perspective") ? $user->getActivePerspective() : $user->getFirstAllowedPerspective();
}
if ($requestedPerspective != $user->getActivePerspective()) {
$user->setActivePerspective($requestedPerspective);
$user->save();
}
return $this;
}