当前位置: 首页>>代码示例>>PHP>>正文


PHP User::save方法代码示例

本文整理汇总了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;
 }
开发者ID:rolandstoll,项目名称:pimcore,代码行数:20,代码来源:Authentication.php

示例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;
 }
开发者ID:solverat,项目名称:pimcore,代码行数:29,代码来源:Admin.php

示例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;
 }
开发者ID:pimcore,项目名称:pimcore,代码行数:29,代码来源:Admin.php


注:本文中的Pimcore\Model\User::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。