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


PHP UserAccount::update方法代码示例

本文整理汇总了PHP中UserAccount::update方法的典型用法代码示例。如果您正苦于以下问题:PHP UserAccount::update方法的具体用法?PHP UserAccount::update怎么用?PHP UserAccount::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserAccount的用法示例。


在下文中一共展示了UserAccount::update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setupUsers

 public static function setupUsers($data)
 {
     self::dbFixture(\UserAccount::getTableName(), array());
     foreach ($data as $key => $userRow) {
         $userRights = null;
         if (!isset($userRow['password'])) {
             $userRow['password'] = self::DefaultPassword;
         }
         self::checkUserRow($userRow);
         if (isset($userRow['rights'])) {
             $userRights = $userRow['rights'];
         }
         $userRow['password'] = Password::hash($userRow['password']);
         $user = new \UserAccount($userRow);
         $user->insert();
         if (!empty($userRights)) {
             $user->rights = $userRights;
             $user->update();
         }
     }
 }
开发者ID:gudwin,项目名称:extasy,代码行数:21,代码来源:Helper.php

示例2: update

    public function update($group, $permissions)
    {
        if (empty($group)) {
            $this->AddAlert('Группа пользователей не выбрана');
            $this->jump('./');
        }
        set_time_limit(0);
        $page = 0;
        $groupInfo = DBSimple::get(ACL_TABLE, ['name' => $group]);
        if (empty($groupInfo)) {
            throw new \InvalidArgumentException(sprintf('Group "%s" not found, failed to update group permissions', htmlspecialchars($group)));
        }
        $permissions = $this->filterPermissionsByGroup($group, $permissions);
        do {
            // получаем пользователей
            $sql = <<<SQL
\tselect u.* from %s as u
\tinner join %s as r
\ton r.entity = concat("%s", u.id)
\twhere r.actionId = "%s"
\torder by id asc
\tlimit %d,%d
SQL;
            $sql = sprintf($sql, \UserAccount::getTableName(), \ACL_GRANT_TABLE, \Faid\DB::escape(\UserAccount::ModelName), $groupInfo['id'], $page * self::Limit, self::Limit);
            $data = DB::query($sql);
            // устанавливаем каждому права
            foreach ($data as $row) {
                $user = new \UserAccount($row);
                $tmp = $user->rights->getValue();
                $tmp = array_merge($tmp, $permissions);
                $user->rights = $tmp;
                $user->update();
            }
            $page++;
        } while (sizeof($data) != 0);
        $this->addAlert('Права обновлены');
        $this->jump('./');
    }
开发者ID:gudwin,项目名称:extasy,代码行数:38,代码来源:GroupPermissions.php

示例3: activateEmail

 public static function activateEmail($code)
 {
     $found = DBSimple::get(self::getTableName(), array('email_confirmation_code' => $code));
     if (empty($found)) {
         throw new NotFoundException('Confirmation code not found ');
     }
     $result = new UserAccount($found);
     $result->email->setValue($result->new_email->getValue());
     $result->new_email->setValue('');
     $result->email_confirmation_code->setValue('');
     $result->update();
     return $result;
 }
开发者ID:gudwin,项目名称:extasy,代码行数:13,代码来源:account.php

示例4: blockUser

 public function blockUser(\UserAccount $user)
 {
     \CMSLog::addMessage(self::LogName, sprintf('Users with login %s blocked ', $user->login->getValue()));
     $user->confirmation_code = \UsersRegistration::getConfirmationCode();
     $user->update();
 }
开发者ID:gudwin,项目名称:extasy,代码行数:6,代码来源:LoginAttemptsException.php


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