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


PHP IConfig::deleteUserValue方法代码示例

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


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

示例1: logout

 /**
  * @NoAdminRequired
  * @UseSession
  *
  * @return RedirectResponse
  */
 public function logout()
 {
     $loginToken = $this->request->getCookie('oc_token');
     if (!is_null($loginToken)) {
         $this->config->deleteUserValue($this->userSession->getUser()->getUID(), 'login_token', $loginToken);
     }
     $this->userSession->logout();
     return new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm'));
 }
开发者ID:stweil,项目名称:owncloud-core,代码行数:15,代码来源:LoginController.php

示例2: setMailAddress

 /**
  * Set the mail address of a user
  *
  * @NoAdminRequired
  * @NoSubadminRequired
  *
  * @param string $id
  * @param string $mailAddress
  * @return DataResponse
  */
 public function setMailAddress($id, $mailAddress)
 {
     $userId = $this->userSession->getUser()->getUID();
     $user = $this->userManager->get($id);
     if ($userId !== $id && !$this->isAdmin && !$this->groupManager->getSubAdmin()->isUserAccessible($this->userSession->getUser(), $user)) {
         return new DataResponse(array('status' => 'error', 'data' => array('message' => (string) $this->l10n->t('Forbidden'))), Http::STATUS_FORBIDDEN);
     }
     if ($mailAddress !== '' && !$this->mailer->validateMailAddress($mailAddress)) {
         return new DataResponse(array('status' => 'error', 'data' => array('message' => (string) $this->l10n->t('Invalid mail address'))), Http::STATUS_UNPROCESSABLE_ENTITY);
     }
     if (!$user) {
         return new DataResponse(array('status' => 'error', 'data' => array('message' => (string) $this->l10n->t('Invalid user'))), Http::STATUS_UNPROCESSABLE_ENTITY);
     }
     // this is the only permission a backend provides and is also used
     // for the permission of setting a email address
     if (!$user->canChangeDisplayName()) {
         return new DataResponse(array('status' => 'error', 'data' => array('message' => (string) $this->l10n->t('Unable to change mail address'))), Http::STATUS_FORBIDDEN);
     }
     // delete user value if email address is empty
     if ($mailAddress === '') {
         $this->config->deleteUserValue($id, 'settings', 'email');
     } else {
         $this->config->setUserValue($id, 'settings', 'email', $mailAddress);
     }
     return new DataResponse(array('status' => 'success', 'data' => array('username' => $id, 'mailAddress' => $mailAddress, 'message' => (string) $this->l10n->t('Email saved'))), Http::STATUS_OK);
 }
开发者ID:evanjt,项目名称:core,代码行数:36,代码来源:userscontroller.php

示例3: setPassword

 /**
  * @PublicPage
  * @param string $token
  * @param string $userId
  * @param string $password
  * @param boolean $proceed
  * @return array
  */
 public function setPassword($token, $userId, $password, $proceed)
 {
     if ($this->isDataEncrypted && !$proceed) {
         return $this->error('', array('encryption' => true));
     }
     try {
         $user = $this->userManager->get($userId);
         $splittedToken = explode(':', $this->config->getUserValue($userId, 'owncloud', 'lostpassword', null));
         if (count($splittedToken) !== 2) {
             throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid'));
         }
         if ($splittedToken[0] < $this->timeFactory->getTime() - 60 * 60 * 12 || $user->getLastLogin() > $splittedToken[0]) {
             throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is expired'));
         }
         if (!StringUtils::equals($splittedToken[1], $token)) {
             throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid'));
         }
         if (!$user->setPassword($password)) {
             throw new \Exception();
         }
         \OC_Hook::emit('\\OC\\Core\\LostPassword\\Controller\\LostController', 'post_passwordReset', array('uid' => $userId, 'password' => $password));
         $this->config->deleteUserValue($userId, 'owncloud', 'lostpassword');
         @\OC_User::unsetMagicInCookie();
     } catch (\Exception $e) {
         return $this->error($e->getMessage());
     }
     return $this->success();
 }
开发者ID:enoch85,项目名称:owncloud-testserver,代码行数:36,代码来源:lostcontroller.php

示例4: updateDB

 /**
  * update database
  */
 public function updateDB()
 {
     // make sure that we don't update the file cache multiple times
     // only update during the first run
     if ($this->installedVersion === '-1') {
         return;
     }
     // delete left-over from old encryption which is no longer needed
     $this->config->deleteAppValue('files_encryption', 'ocsid');
     $this->config->deleteAppValue('files_encryption', 'types');
     $this->config->deleteAppValue('files_encryption', 'enabled');
     $oldAppValues = $this->connection->createQueryBuilder();
     $oldAppValues->select('*')->from('`*PREFIX*appconfig`')->where($oldAppValues->expr()->eq('`appid`', ':appid'))->setParameter('appid', 'files_encryption');
     $appSettings = $oldAppValues->execute();
     while ($row = $appSettings->fetch()) {
         // 'installed_version' gets deleted at the end of the migration process
         if ($row['configkey'] !== 'installed_version') {
             $this->config->setAppValue('encryption', $row['configkey'], $row['configvalue']);
             $this->config->deleteAppValue('files_encryption', $row['configkey']);
         }
     }
     $oldPreferences = $this->connection->createQueryBuilder();
     $oldPreferences->select('*')->from('`*PREFIX*preferences`')->where($oldPreferences->expr()->eq('`appid`', ':appid'))->setParameter('appid', 'files_encryption');
     $preferenceSettings = $oldPreferences->execute();
     while ($row = $preferenceSettings->fetch()) {
         $this->config->setUserValue($row['userid'], 'encryption', $row['configkey'], $row['configvalue']);
         $this->config->deleteUserValue($row['userid'], 'files_encryption', $row['configkey']);
     }
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:32,代码来源:migration.php

示例5: setEMailAddress

 /**
  * set the email address of the user
  *
  * @param string|null $mailAddress
  * @return void
  * @since 9.0.0
  */
 public function setEMailAddress($mailAddress)
 {
     if ($mailAddress === '') {
         $this->config->deleteUserValue($this->uid, 'settings', 'email');
     } else {
         $this->config->setUserValue($this->uid, 'settings', 'email', $mailAddress);
     }
     $this->triggerChange('eMailAddress', $mailAddress);
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:16,代码来源:User.php

示例6: setEMailAddress

 /**
  * set the email address of the user
  *
  * @param string|null $mailAddress
  * @return void
  * @since 9.0.0
  */
 public function setEMailAddress($mailAddress)
 {
     if ($mailAddress === '') {
         $this->config->deleteUserValue($this->uid, 'settings', 'email');
     } else {
         $this->config->setUserValue($this->uid, 'settings', 'email', $mailAddress);
     }
     if ($this->emitter) {
         $this->emitter->emit('\\OC\\User', 'changeUser', array($this));
     }
 }
开发者ID:RomanKreisel,项目名称:core,代码行数:18,代码来源:user.php

示例7: setPassword

 /**
  * @PublicPage
  * @param string $token
  * @param string $userId
  * @param string $password
  * @param boolean $proceed
  * @return array
  */
 public function setPassword($token, $userId, $password, $proceed)
 {
     if ($this->isDataEncrypted && !$proceed) {
         return $this->error('', array('encryption' => true));
     }
     try {
         $this->checkPasswordResetToken($token, $userId);
         $user = $this->userManager->get($userId);
         if (!$user->setPassword($password)) {
             throw new \Exception();
         }
         \OC_Hook::emit('\\OC\\Core\\LostPassword\\Controller\\LostController', 'post_passwordReset', array('uid' => $userId, 'password' => $password));
         $this->config->deleteUserValue($userId, 'owncloud', 'lostpassword');
         @\OC_User::unsetMagicInCookie();
     } catch (\Exception $e) {
         return $this->error($e->getMessage());
     }
     return $this->success();
 }
开发者ID:rchicoli,项目名称:owncloud-core,代码行数:27,代码来源:LostController.php

示例8: updateDB

 /**
  * update database
  */
 public function updateDB()
 {
     // delete left-over from old encryption which is no longer needed
     $this->config->deleteAppValue('files_encryption', 'ocsid');
     $this->config->deleteAppValue('files_encryption', 'types');
     $this->config->deleteAppValue('files_encryption', 'enabled');
     $oldAppValues = $this->connection->getQueryBuilder();
     $oldAppValues->select('*')->from('*PREFIX*appconfig')->where($oldAppValues->expr()->eq('appid', $oldAppValues->createParameter('appid')))->setParameter('appid', 'files_encryption');
     $appSettings = $oldAppValues->execute();
     while ($row = $appSettings->fetch()) {
         // 'installed_version' gets deleted at the end of the migration process
         if ($row['configkey'] !== 'installed_version') {
             $this->config->setAppValue('encryption', $row['configkey'], $row['configvalue']);
             $this->config->deleteAppValue('files_encryption', $row['configkey']);
         }
     }
     $oldPreferences = $this->connection->getQueryBuilder();
     $oldPreferences->select('*')->from('*PREFIX*preferences')->where($oldPreferences->expr()->eq('appid', $oldPreferences->createParameter('appid')))->setParameter('appid', 'files_encryption');
     $preferenceSettings = $oldPreferences->execute();
     while ($row = $preferenceSettings->fetch()) {
         $this->config->setUserValue($row['userid'], 'encryption', $row['configkey'], $row['configvalue']);
         $this->config->deleteUserValue($row['userid'], 'files_encryption', $row['configkey']);
     }
 }
开发者ID:jemygraw,项目名称:core,代码行数:27,代码来源:migration.php

示例9: deleteKey

 /**
  * Deletes a key
  * @param string $user user
  * @param string $app app
  * @param string $key key
  * @deprecated use deleteUserValue of \OCP\IConfig instead
  *
  * Deletes a key.
  */
 public function deleteKey($user, $app, $key)
 {
     $this->config->deleteUserValue($user, $app, $key);
 }
开发者ID:samj1912,项目名称:repo,代码行数:13,代码来源:preferences.php

示例10: enableTwoFactorAuthentication

 /**
  * Enable all 2FA checks for the given user
  *
  * @param IUser $user
  */
 public function enableTwoFactorAuthentication(IUser $user)
 {
     $this->config->deleteUserValue($user->getUID(), 'core', 'two_factor_auth_disabled');
 }
开发者ID:GitHubUser4234,项目名称:core,代码行数:9,代码来源:Manager.php


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