本文整理汇总了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();
}
}
}
示例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('./');
}
示例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;
}
示例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();
}