/**
  * reads LDAP users marked as deleted from the database
  * @return OCA\user_ldap\lib\user\OfflineUser[]
  */
 private function fetchDeletedUsers()
 {
     $deletedUsers = $this->config->getUsersForUserValue('user_ldap', 'isDeleted', '1');
     $userObjects = array();
     foreach ($deletedUsers as $user) {
         $userObjects[] = new OfflineUser($user, $this->config, $this->db, $this->mapping);
     }
     $this->deletedUsers = $userObjects;
     return $this->deletedUsers;
 }
Пример #2
0
 /**
  * @param string $email
  * @return IUser[]
  * @since 9.1.0
  */
 public function getByEmail($email)
 {
     $userIds = $this->config->getUsersForUserValue('settings', 'email', $email);
     return array_map(function ($uid) {
         return $this->get($uid);
     }, $userIds);
 }
Пример #3
0
 /**
  * Get the user for the token
  *
  * @return string
  * @throws \UnexpectedValueException If the token is invalid, does not exist or is not unique
  */
 protected function getUserFromToken()
 {
     $token = (string) $this->request->getParam('token', '');
     if (strlen($token) !== 30) {
         throw new \UnexpectedValueException('The token is invalid');
     }
     $users = $this->config->getUsersForUserValue('activity', 'rsstoken', $token);
     if (sizeof($users) !== 1) {
         // No unique user found
         throw new \UnexpectedValueException('The token is invalid');
     }
     // Token found login as that user
     return array_shift($users);
 }
Пример #4
0
 /**
  * @NoAdminRequired
  *
  * @param string $enable	'true' if the feed is enabled
  * @return DataResponse
  */
 public function feed($enable)
 {
     $token = $tokenUrl = '';
     if ($enable === 'true') {
         $conflicts = true;
         // Check for collisions
         while (!empty($conflicts)) {
             $token = $this->random->generate(30);
             $conflicts = $this->config->getUsersForUserValue('activity', 'rsstoken', $token);
         }
         $tokenUrl = $this->urlGenerator->linkToRouteAbsolute('activity.Feed.show', ['token' => $token]);
     }
     $this->config->setUserValue($this->user, 'activity', 'rsstoken', $token);
     return new DataResponse(array('data' => array('message' => (string) $this->l10n->t('Your settings have been updated.'), 'rsslink' => $tokenUrl)));
 }
Пример #5
0
 /**
  * Gets the users for a preference
  * @param string $app
  * @param string $key
  * @param string $value
  * @return array
  * @deprecated use getUsersForUserValue of \OCP\IConfig instead
  */
 public function getUsersForValue($app, $key, $value)
 {
     return $this->config->getUsersForUserValue($app, $key, $value);
 }