コード例 #1
0
 /**
  * checks whether a user is actually mapped
  * @param string $ocName the username as used in ownCloud
  * @throws \Exception
  * @return true
  */
 protected function confirmUserIsMapped($ocName)
 {
     $dn = $this->mapping->getDNByName($ocName);
     if ($dn === false) {
         throw new \Exception('The given user is not a recognized LDAP user.');
     }
     return true;
 }
コード例 #2
0
 /**
  * prepares the LDAP environment and sets up a test configuration for
  * the LDAP backend.
  */
 public function init()
 {
     require __DIR__ . '/../setup-scripts/createExplicitUsers.php';
     parent::init();
     $this->mapping = new UserMapping(\OC::$server->getDatabaseConnection());
     $this->mapping->clear();
     $this->access->setUserMapper($this->mapping);
     $this->backend = new \OCA\user_ldap\USER_LDAP($this->access, \OC::$server->getConfig());
 }
コード例 #3
0
 /**
  * A method that does the common steps of test cases 1 and 2. The evaluation
  * is not happening here.
  *
  * @param string $dn
  * @param string $username
  * @param string $image
  */
 private function execFetchTest($dn, $username, $image)
 {
     $this->setJpegPhotoAttribute($dn, $image);
     // assigns our self-picked oc username to the dn
     $this->mapping->map($dn, $username, 'fakeUUID-' . $username);
     // initialize home folder and make sure that the user will update
     // also remove an possibly existing avatar
     \OC_Util::tearDownFS();
     \OC_Util::setupFS($username);
     \OC::$server->getUserFolder($username);
     \OC::$server->getConfig()->deleteUserValue($username, 'user_ldap', User::USER_PREFKEY_LASTREFRESH);
     if (\OC::$server->getAvatarManager()->getAvatar($username)->exists()) {
         \OC::$server->getAvatarManager()->getAvatar($username)->remove();
     }
     // finally attempt to get the avatar set
     $user = $this->userManager->get($dn);
     $user->updateAvatar();
 }
コード例 #4
0
ファイル: offlineuser.php プロジェクト: kenwi/core
 /**
  * reads the user details
  */
 protected function fetchDetails()
 {
     $properties = array('displayName' => 'user_ldap', 'uid' => 'user_ldap', 'homePath' => 'user_ldap', 'email' => 'settings', 'lastLogin' => 'login');
     foreach ($properties as $property => $app) {
         $this->{$property} = $this->config->getUserValue($this->ocName, $app, $property, '');
     }
     $dn = $this->mapping->getDNByName($this->ocName);
     $this->dn = $dn !== false ? $dn : '';
     $this->determineShares();
 }
コード例 #5
0
ファイル: cleanup.php プロジェクト: Kevin-ZK/vaneDisk
 /**
  * makes the background job do its work
  * @param array $argument
  */
 public function run($argument)
 {
     $this->setArguments($argument);
     if (!$this->isCleanUpAllowed()) {
         return;
     }
     $users = $this->mapping->getList($this->getOffset(), $this->limit);
     if (!is_array($users)) {
         //something wrong? Let's start from the beginning next time and
         //abort
         $this->setOffset(true);
         return;
     }
     $resetOffset = $this->isOffsetResetNecessary(count($users));
     $this->checkUsers($users);
     $this->setOffset($resetOffset);
 }
コード例 #6
0
 /**
  * adds a map entry for the user, so we know the username
  *
  * @param $dn
  * @param $username
  */
 private function prepareUser($dn, $username)
 {
     // assigns our self-picked oc username to the dn
     $this->mapping->map($dn, $username, 'fakeUUID-' . $username);
 }