Ejemplo n.º 1
0
 /**
  * check if a user exists on LDAP
  * @param string|\OCA\User_LDAP\lib\User\User $user either the ownCloud user
  * name or an instance of that user
  * @return boolean
  */
 public function userExistsOnLDAP($user)
 {
     $id = $user instanceof User ? $user->getUsername() : $user;
     return $this->handleRequest($id, 'userExistsOnLDAP', array($user));
 }
Ejemplo n.º 2
0
Archivo: user.php Proyecto: kenwi/core
 /**
  * @expectedException \Exception
  */
 public function testGetHomePathConfiguredNotAvailableNotAllowed()
 {
     list($access, $config, $filesys, $image, $log, $avaMgr, $dbc) = $this->getTestInstances();
     list($access, $connection) = $this->getAdvancedMocks($config, $filesys, $log, $avaMgr, $dbc);
     $connection->expects($this->any())->method('__get')->with($this->equalTo('homeFolderNamingRule'))->will($this->returnValue('attr:foobar'));
     $access->expects($this->once())->method('readAttribute')->will($this->returnValue(false));
     // asks for "enforce_home_folder_naming_rule"
     $config->expects($this->once())->method('getAppValue')->will($this->returnValue(true));
     $uid = 'alice';
     $dn = 'uid=alice,dc=foo,dc=bar';
     $user = new User($uid, $dn, $access, $config, $filesys, $image, $log, $avaMgr);
     $user->getHomePath();
 }
Ejemplo n.º 3
0
 /**
  * @dataProvider displayNameProvider
  */
 public function testComposeAndStoreDisplayName($part1, $part2, $expected)
 {
     list($access, $config, $filesys, $image, $log, $avaMgr, , $userMgr) = $this->getTestInstances();
     $config->expects($this->once())->method('setUserValue');
     $user = new User('user', 'cn=user', $access, $config, $filesys, $image, $log, $avaMgr, $userMgr);
     $displayName = $user->composeAndStoreDisplayName($part1, $part2);
     $this->assertSame($expected, $displayName);
 }
Ejemplo n.º 4
0
 public function testGetAvatarImageProvided()
 {
     list($access, $config, $filesys, $image, $log, $avaMgr) = $this->getTestInstances();
     $access->expects($this->once())->method('readAttribute')->with($this->equalTo('uid=alice,dc=foo,dc=bar'), $this->equalTo('jpegPhoto'))->will($this->returnValue(array('this is a photo')));
     $uid = 'alice';
     $dn = 'uid=alice,dc=foo,dc=bar';
     $user = new User($uid, $dn, $access, $config, $filesys, $image, $log, $avaMgr);
     $photo = $user->getAvatarImage();
     $this->assertSame('this is a photo', $photo);
     //make sure readAttribute is not called again but the already fetched
     //photo is returned
     $photo = $user->getAvatarImage();
 }