Merge pull request #24604 from owncloud/user_ldap-psr4

Move user_ldap to PSR-4
This commit is contained in:
Vincent Petry 2016-05-25 17:11:10 +02:00
commit 379f8a1e45
81 changed files with 377 additions and 384 deletions

View File

@ -30,7 +30,7 @@ OCP\JSON::checkAppEnabled('user_ldap');
OCP\JSON::callCheck();
$prefix = (string)$_POST['ldap_serverconfig_chooser'];
$helper = new \OCA\user_ldap\lib\Helper();
$helper = new \OCA\User_LDAP\Helper();
if($helper->deleteServerConfiguration($prefix)) {
OCP\JSON::success();
} else {

View File

@ -28,6 +28,6 @@ OCP\JSON::checkAppEnabled('user_ldap');
OCP\JSON::callCheck();
$prefix = (string)$_POST['ldap_serverconfig_chooser'];
$ldapWrapper = new OCA\user_ldap\lib\LDAP();
$connection = new \OCA\user_ldap\lib\Connection($ldapWrapper, $prefix);
$ldapWrapper = new OCA\User_LDAP\LDAP();
$connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix);
OCP\JSON::success(array('configuration' => $connection->getConfiguration()));

View File

@ -25,7 +25,7 @@ OCP\JSON::checkAdminUser();
OCP\JSON::checkAppEnabled('user_ldap');
OCP\JSON::callCheck();
$helper = new \OCA\user_ldap\lib\Helper();
$helper = new \OCA\User_LDAP\Helper();
$serverConnections = $helper->getServerConfigurationPrefixes();
sort($serverConnections);
$lk = array_pop($serverConnections);
@ -34,12 +34,12 @@ $nk = 's'.str_pad($ln+1, 2, '0', STR_PAD_LEFT);
$resultData = array('configPrefix' => $nk);
$newConfig = new \OCA\user_ldap\lib\Configuration($nk, false);
$newConfig = new \OCA\User_LDAP\Configuration($nk, false);
if(isset($_POST['copyConfig'])) {
$originalConfig = new \OCA\user_ldap\lib\Configuration($_POST['copyConfig']);
$originalConfig = new \OCA\User_LDAP\Configuration($_POST['copyConfig']);
$newConfig->setConfiguration($originalConfig->getConfiguration());
} else {
$configuration = new \OCA\user_ldap\lib\Configuration($nk, false);
$configuration = new \OCA\User_LDAP\Configuration($nk, false);
$newConfig->setConfiguration($configuration->getDefaults());
$resultData['defaults'] = $configuration->getDefaults();
}

View File

@ -41,8 +41,8 @@ foreach($chkboxes as $boxid) {
}
}
$ldapWrapper = new OCA\user_ldap\lib\LDAP();
$connection = new \OCA\user_ldap\lib\Connection($ldapWrapper, $prefix);
$ldapWrapper = new OCA\User_LDAP\LDAP();
$connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix);
$connection->setConfiguration($_POST);
$connection->saveConfiguration();
OCP\JSON::success();

View File

@ -30,8 +30,8 @@ OCP\JSON::callCheck();
$l = \OC::$server->getL10N('user_ldap');
$ldapWrapper = new OCA\user_ldap\lib\LDAP();
$connection = new \OCA\user_ldap\lib\Connection($ldapWrapper, '', null);
$ldapWrapper = new OCA\User_LDAP\LDAP();
$connection = new \OCA\User_LDAP\Connection($ldapWrapper, '', null);
//needs to be true, otherwise it will also fail with an irritating message
$_POST['ldap_configuration_active'] = 1;

View File

@ -41,26 +41,26 @@ if(!isset($_POST['ldap_serverconfig_chooser'])) {
}
$prefix = (string)$_POST['ldap_serverconfig_chooser'];
$ldapWrapper = new \OCA\user_ldap\lib\LDAP();
$configuration = new \OCA\user_ldap\lib\Configuration($prefix);
$ldapWrapper = new \OCA\User_LDAP\LDAP();
$configuration = new \OCA\User_LDAP\Configuration($prefix);
$con = new \OCA\user_ldap\lib\Connection($ldapWrapper, '', null);
$con = new \OCA\User_LDAP\Connection($ldapWrapper, '', null);
$con->setConfiguration($configuration->getConfiguration());
$con->ldapConfigurationActive = true;
$con->setIgnoreValidation(true);
$userManager = new \OCA\user_ldap\lib\user\Manager(
$userManager = new \OCA\User_LDAP\User\Manager(
\OC::$server->getConfig(),
new \OCA\user_ldap\lib\FilesystemHelper(),
new \OCA\user_ldap\lib\LogWrapper(),
new \OCA\User_LDAP\FilesystemHelper(),
new \OCA\User_LDAP\LogWrapper(),
\OC::$server->getAvatarManager(),
new \OCP\Image(),
\OC::$server->getDatabaseConnection(),
\OC::$server->getUserManager());
$access = new \OCA\user_ldap\lib\Access($con, $ldapWrapper, $userManager);
$access = new \OCA\User_LDAP\Access($con, $ldapWrapper, $userManager);
$wizard = new \OCA\user_ldap\lib\Wizard($configuration, $ldapWrapper, $access);
$wizard = new \OCA\User_LDAP\Wizard($configuration, $ldapWrapper, $access);
switch($action) {
case 'guessPortAndTLS':
@ -127,7 +127,7 @@ switch($action) {
}
$configuration->saveConfiguration();
//clear the cache on save
$connection = new \OCA\user_ldap\lib\Connection($ldapWrapper, $prefix);
$connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix);
$connection->clearCache();
OCP\JSON::success();
break;

View File

@ -27,32 +27,32 @@
OCP\App::registerAdmin('user_ldap', 'settings');
$helper = new \OCA\user_ldap\lib\Helper();
$helper = new \OCA\User_LDAP\Helper();
$configPrefixes = $helper->getServerConfigurationPrefixes(true);
$ldapWrapper = new OCA\user_ldap\lib\LDAP();
$ldapWrapper = new OCA\User_LDAP\LDAP();
$ocConfig = \OC::$server->getConfig();
if(count($configPrefixes) === 1) {
$dbc = \OC::$server->getDatabaseConnection();
$userManager = new OCA\user_ldap\lib\user\Manager($ocConfig,
new OCA\user_ldap\lib\FilesystemHelper(),
new OCA\user_ldap\lib\LogWrapper(),
$userManager = new OCA\User_LDAP\User\Manager($ocConfig,
new OCA\User_LDAP\FilesystemHelper(),
new OCA\User_LDAP\LogWrapper(),
\OC::$server->getAvatarManager(),
new \OCP\Image(),
$dbc,
\OC::$server->getUserManager()
);
$connector = new OCA\user_ldap\lib\Connection($ldapWrapper, $configPrefixes[0]);
$ldapAccess = new OCA\user_ldap\lib\Access($connector, $ldapWrapper, $userManager);
$connector = new OCA\User_LDAP\Connection($ldapWrapper, $configPrefixes[0]);
$ldapAccess = new OCA\User_LDAP\Access($connector, $ldapWrapper, $userManager);
$ldapAccess->setUserMapper(new OCA\User_LDAP\Mapping\UserMapping($dbc));
$ldapAccess->setGroupMapper(new OCA\User_LDAP\Mapping\GroupMapping($dbc));
$userBackend = new OCA\user_ldap\USER_LDAP($ldapAccess, $ocConfig);
$groupBackend = new OCA\user_ldap\GROUP_LDAP($ldapAccess);
$userBackend = new OCA\User_LDAP\User_LDAP($ldapAccess, $ocConfig);
$groupBackend = new \OCA\User_LDAP\Group_LDAP($ldapAccess);
} else if(count($configPrefixes) > 1) {
$userBackend = new OCA\user_ldap\User_Proxy(
$userBackend = new OCA\User_LDAP\User_Proxy(
$configPrefixes, $ldapWrapper, $ocConfig
);
$groupBackend = new OCA\user_ldap\Group_Proxy($configPrefixes, $ldapWrapper);
$groupBackend = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper);
}
if(count($configPrefixes) > 0) {
@ -64,7 +64,7 @@ if(count($configPrefixes) > 0) {
\OCP\Util::connectHook(
'\OCA\Files_Sharing\API\Server2Server',
'preLoginNameUsedAsUserName',
'\OCA\user_ldap\lib\Helper',
'\OCA\User_LDAP\Helper',
'loginName2UserName'
);

View File

@ -21,8 +21,10 @@ A user logs into ownCloud with their LDAP or AD credentials, and is granted acce
<owncloud min-version="9.1" max-version="9.1" />
</dependencies>
<namespace>User_LDAP</namespace>
<background-jobs>
<job>OCA\user_ldap\lib\Jobs</job>
<job>\OCA\User_LDAP\Jobs\CleanUp</job>
<job>OCA\User_LDAP\Jobs\UpdateGroups</job>
<job>OCA\User_LDAP\Jobs\CleanUp</job>
</background-jobs>
</info>

View File

@ -21,11 +21,11 @@
*
*/
use OCA\user_ldap\lib\Helper;
use OCA\user_ldap\lib\LDAP;
use OCA\user_ldap\User_Proxy;
use OCA\User_LDAP\Helper;
use OCA\User_LDAP\LDAP;
use OCA\User_LDAP\User_Proxy;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\User_LDAP\lib\User\DeletedUsersIndex;
use OCA\User_LDAP\User\DeletedUsersIndex;
$dbConnection = \OC::$server->getDatabaseConnection();
$userMapping = new UserMapping($dbConnection);
@ -40,15 +40,15 @@ $deletedUsersIndex = new DeletedUsersIndex(
$ocConfig, $dbConnection, $userMapping
);
$application->add(new OCA\user_ldap\Command\ShowConfig($helper));
$application->add(new OCA\user_ldap\Command\SetConfig());
$application->add(new OCA\user_ldap\Command\TestConfig());
$application->add(new OCA\user_ldap\Command\CreateEmptyConfig($helper));
$application->add(new OCA\user_ldap\Command\DeleteConfig($helper));
$application->add(new OCA\user_ldap\Command\Search($ocConfig));
$application->add(new OCA\user_ldap\Command\ShowRemnants(
$application->add(new OCA\User_LDAP\Command\ShowConfig($helper));
$application->add(new OCA\User_LDAP\Command\SetConfig());
$application->add(new OCA\User_LDAP\Command\TestConfig());
$application->add(new OCA\User_LDAP\Command\CreateEmptyConfig($helper));
$application->add(new OCA\User_LDAP\Command\DeleteConfig($helper));
$application->add(new OCA\User_LDAP\Command\Search($ocConfig));
$application->add(new OCA\User_LDAP\Command\ShowRemnants(
$deletedUsersIndex, \OC::$server->getDateTimeFormatter())
);
$application->add(new OCA\user_ldap\Command\CheckUser(
$application->add(new OCA\User_LDAP\Command\CheckUser(
$uBackend, $helper, $deletedUsersIndex, $userMapping)
);

View File

@ -35,18 +35,20 @@
*
*/
namespace OCA\user_ldap\lib;
namespace OCA\User_LDAP;
use OCA\user_ldap\lib\user\OfflineUser;
use OCA\User_LDAP\User\IUserTools;
use OCA\User_LDAP\User\Manager;
use OCA\User_LDAP\User\OfflineUser;
use OCA\User_LDAP\Mapping\AbstractMapping;
/**
* Class Access
* @package OCA\user_ldap\lib
* @package OCA\User_LDAP
*/
class Access extends LDAPUtility implements user\IUserTools {
class Access extends LDAPUtility implements IUserTools {
/**
* @var \OCA\user_ldap\lib\Connection
* @var \OCA\User_LDAP\Connection
*/
public $connection;
public $userManager;
@ -75,7 +77,7 @@ class Access extends LDAPUtility implements user\IUserTools {
protected $groupMapper;
public function __construct(Connection $connection, ILDAPWrapper $ldap,
user\Manager $userManager) {
Manager $userManager) {
parent::__construct($ldap);
$this->connection = $connection;
$this->userManager = $userManager;
@ -131,7 +133,7 @@ class Access extends LDAPUtility implements user\IUserTools {
/**
* returns the Connection instance
* @return \OCA\user_ldap\lib\Connection
* @return \OCA\User_LDAP\Connection
*/
public function getConnection() {
return $this->connection;
@ -314,7 +316,7 @@ class Access extends LDAPUtility implements user\IUserTools {
* @return string|false LDAP DN on success, otherwise false
*/
public function groupname2dn($name) {
return $this->groupMapper->getDNbyName($name);
return $this->groupMapper->getDNByName($name);
}
/**
@ -323,7 +325,7 @@ class Access extends LDAPUtility implements user\IUserTools {
* @return string|false with the LDAP DN on success, otherwise false
*/
public function username2dn($name) {
$fdn = $this->userMapper->getDNbyName($name);
$fdn = $this->userMapper->getDNByName($name);
//Check whether the DN belongs to the Base, to avoid issues on multi-
//server setups

View File

@ -21,7 +21,7 @@
*
*/
namespace OCA\user_ldap\lib;
namespace OCA\User_LDAP;
abstract class BackendUtility {

View File

@ -20,7 +20,7 @@
*
*/
namespace OCA\user_ldap\Command;
namespace OCA\User_LDAP\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
@ -28,30 +28,29 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use OCA\user_ldap\lib\user\User;
use OCA\User_LDAP\lib\User\DeletedUsersIndex;
use OCA\User_LDAP\User\DeletedUsersIndex;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\user_ldap\lib\Helper as LDAPHelper;
use OCA\user_ldap\User_Proxy;
use OCA\User_LDAP\Helper as LDAPHelper;
use OCA\User_LDAP\User_Proxy;
class CheckUser extends Command {
/** @var \OCA\user_ldap\User_Proxy */
/** @var \OCA\User_LDAP\User_Proxy */
protected $backend;
/** @var \OCA\User_LDAP\lib\Helper */
/** @var \OCA\User_LDAP\Helper */
protected $helper;
/** @var \OCA\User_LDAP\lib\User\DeletedUsersIndex */
/** @var \OCA\User_LDAP\User\DeletedUsersIndex */
protected $dui;
/** @var \OCA\User_LDAP\Mapping\UserMapping */
protected $mapping;
/**
* @param OCA\user_ldap\User_Proxy $uBackend
* @param OCA\user_ldap\lib\Helper $helper
* @param OCA\User_LDAP\lib\User\DeletedUsersIndex $dui
* @param OCA\User_LDAP\Mapping\UserMapping $mapping
* @param User_Proxy $uBackend
* @param LDAPHelper $helper
* @param DeletedUsersIndex $dui
* @param UserMapping $mapping
*/
public function __construct(User_Proxy $uBackend, LDAPHelper $helper, DeletedUsersIndex $dui, UserMapping $mapping) {
$this->backend = $uBackend;

View File

@ -21,18 +21,16 @@
*
*/
namespace OCA\user_ldap\Command;
namespace OCA\User_LDAP\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use \OCA\user_ldap\lib\Helper;
use \OCA\user_ldap\lib\Configuration;
use \OCA\User_LDAP\Helper;
use \OCA\User_LDAP\Configuration;
class CreateEmptyConfig extends Command {
/** @var \OCA\User_LDAP\lib\Helper */
/** @var \OCA\User_LDAP\Helper */
protected $helper;
/**

View File

@ -21,16 +21,16 @@
*
*/
namespace OCA\user_ldap\Command;
namespace OCA\User_LDAP\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use \OCA\user_ldap\lib\Helper;
use \OCA\User_LDAP\Helper;
class DeleteConfig extends Command {
/** @var \OCA\User_LDAP\lib\Helper */
/** @var \OCA\User_LDAP\Helper */
protected $helper;
/**

View File

@ -20,7 +20,7 @@
*
*/
namespace OCA\user_ldap\Command;
namespace OCA\User_LDAP\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
@ -28,10 +28,10 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use OCA\user_ldap\User_Proxy;
use OCA\user_ldap\Group_Proxy;
use OCA\user_ldap\lib\Helper;
use OCA\user_ldap\lib\LDAP;
use OCA\User_LDAP\User_Proxy;
use OCA\User_LDAP\Group_Proxy;
use OCA\User_LDAP\Helper;
use OCA\User_LDAP\LDAP;
use OCP\IConfig;
class Search extends Command {

View File

@ -21,14 +21,14 @@
*
*/
namespace OCA\user_ldap\Command;
namespace OCA\User_LDAP\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use \OCA\user_ldap\lib\Helper;
use \OCA\user_ldap\lib\Configuration;
use OCA\User_LDAP\Helper;
use OCA\User_LDAP\Configuration;
class SetConfig extends Command {

View File

@ -21,18 +21,18 @@
*
*/
namespace OCA\user_ldap\Command;
namespace OCA\User_LDAP\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use \OCA\user_ldap\lib\Helper;
use \OCA\user_ldap\lib\Configuration;
use OCA\User_LDAP\Helper;
use OCA\User_LDAP\Configuration;
class ShowConfig extends Command {
/** @var \OCA\User_LDAP\lib\Helper */
/** @var \OCA\User_LDAP\Helper */
protected $helper;
/**

View File

@ -21,26 +21,26 @@
*
*/
namespace OCA\user_ldap\Command;
namespace OCA\User_LDAP\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use OCA\user_ldap\lib\user\DeletedUsersIndex;
use OCA\User_LDAP\User\DeletedUsersIndex;
use OCP\IDateTimeFormatter;
class ShowRemnants extends Command {
/** @var \OCA\User_LDAP\lib\User\DeletedUsersIndex */
/** @var \OCA\User_LDAP\User\DeletedUsersIndex */
protected $dui;
/** @var \OCP\IDateTimeFormatter */
protected $dateFormatter;
/**
* @param OCA\user_ldap\lib\user\DeletedUsersIndex $dui
* @param OCP\IDateTimeFormatter $dateFormatter
* @param DeletedUsersIndex $dui
* @param IDateTimeFormatter $dateFormatter
*/
public function __construct(DeletedUsersIndex $dui, IDateTimeFormatter $dateFormatter) {
$this->dui = $dui;
@ -74,7 +74,7 @@ class ShowRemnants extends Command {
$this->dateFormatter->formatDate($user->getLastLogin()) : '-';
$rows[] = array('ocName' => $user->getOCName(),
'displayName' => $user->getDisplayName(),
'uid' => $user->getUid(),
'uid' => $user->getUID(),
'dn' => $user->getDN(),
'lastLogin' => $lastLogin,
'homePath' => $user->getHomePath(),

View File

@ -21,15 +21,14 @@
*
*/
namespace OCA\user_ldap\Command;
namespace OCA\User_LDAP\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use \OCA\user_ldap\lib\Helper;
use \OCA\user_ldap\lib\Connection;
use \OCA\User_LDAP\Helper;
use \OCA\User_LDAP\Connection;
class TestConfig extends Command {
@ -72,7 +71,7 @@ class TestConfig extends Command {
* @return int
*/
protected function testConfig($configID) {
$lw = new \OCA\user_ldap\lib\LDAP();
$lw = new \OCA\User_LDAP\LDAP();
$connection = new Connection($lw, $configID);
//ensure validation is run before we attempt the bind

View File

@ -26,7 +26,7 @@
*
*/
namespace OCA\user_ldap\lib;
namespace OCA\User_LDAP;
/**
* @property int ldapPagingSize holds an integer

View File

@ -26,7 +26,7 @@
*
*/
namespace OCA\user_ldap\lib;
namespace OCA\User_LDAP;
use OC\ServerNotAvailableException;

View File

@ -21,7 +21,7 @@
*
*/
namespace OCA\user_ldap\lib;
namespace OCA\User_LDAP;
/**
* @brief wraps around static ownCloud core methods

View File

@ -32,12 +32,10 @@
*
*/
namespace OCA\user_ldap;
namespace OCA\User_LDAP;
use OCA\user_ldap\lib\Access;
use OCA\user_ldap\lib\BackendUtility;
class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface {
class Group_LDAP extends BackendUtility implements \OCP\GroupInterface {
protected $enabled = false;
/**

View File

@ -22,11 +22,9 @@
*
*/
namespace OCA\user_ldap;
namespace OCA\User_LDAP;
use OCA\user_ldap\lib\ILDAPWrapper;
class Group_Proxy extends lib\Proxy implements \OCP\GroupInterface {
class Group_Proxy extends Proxy implements \OCP\GroupInterface {
private $backends = array();
private $refBackend = null;
@ -38,7 +36,7 @@ class Group_Proxy extends lib\Proxy implements \OCP\GroupInterface {
parent::__construct($ldap);
foreach($serverConfigPrefixes as $configPrefix) {
$this->backends[$configPrefix] =
new \OCA\user_ldap\GROUP_LDAP($this->getAccess($configPrefix));
new \OCA\User_LDAP\Group_LDAP($this->getAccess($configPrefix));
if(is_null($this->refBackend)) {
$this->refBackend = &$this->backends[$configPrefix];
}

View File

@ -25,9 +25,7 @@
*
*/
namespace OCA\user_ldap\lib;
use OCA\user_ldap\User_Proxy;
namespace OCA\User_LDAP;
class Helper {

View File

@ -23,7 +23,7 @@
*
*/
namespace OCA\user_ldap\lib;
namespace OCA\User_LDAP;
interface ILDAPWrapper {

View File

@ -23,11 +23,11 @@
namespace OCA\User_LDAP\Jobs;
use \OC\BackgroundJob\TimedJob;
use \OCA\user_ldap\User_LDAP;
use \OCA\user_ldap\User_Proxy;
use \OCA\user_ldap\lib\Helper;
use \OCA\user_ldap\lib\LDAP;
use \OCA\user_ldap\lib\user\DeletedUsersIndex;
use \OCA\User_LDAP\User_LDAP;
use \OCA\User_LDAP\User_Proxy;
use \OCA\User_LDAP\Helper;
use \OCA\User_LDAP\LDAP;
use \OCA\User_LDAP\User\DeletedUsersIndex;
use \OCA\User_LDAP\Mapping\UserMapping;
/**
@ -35,7 +35,7 @@ use \OCA\User_LDAP\Mapping\UserMapping;
*
* a Background job to clean up deleted users
*
* @package OCA\user_ldap\lib;
* @package OCA\User_LDAP\Jobs;
*/
class CleanUp extends TimedJob {
/** @var int $limit amount of users that should be checked per run */
@ -59,7 +59,7 @@ class CleanUp extends TimedJob {
/** @var \OCA\User_LDAP\Mapping\UserMapping */
protected $mapping;
/** @var \OCA\User_LDAP\lib\User\DeletedUsersIndex */
/** @var \OCA\User_LDAP\User\DeletedUsersIndex */
protected $dui;
public function __construct() {

View File

@ -26,12 +26,19 @@
*
*/
namespace OCA\user_ldap\lib;
namespace OCA\User_LDAP\Jobs;
use OCA\User_LDAP\Access;
use OCA\User_LDAP\Connection;
use OCA\User_LDAP\FilesystemHelper;
use OCA\User_LDAP\Helper;
use OCA\User_LDAP\LDAP;
use OCA\User_LDAP\LogWrapper;
use OCA\User_LDAP\Mapping\GroupMapping;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\User_LDAP\User\Manager;
class Jobs extends \OC\BackgroundJob\TimedJob {
class UpdateGroups extends \OC\BackgroundJob\TimedJob {
static private $groupsFromDB;
static private $groupBE;
@ -45,7 +52,7 @@ class Jobs extends \OC\BackgroundJob\TimedJob {
* @param mixed $argument
*/
public function run($argument){
Jobs::updateGroups();
self::updateGroups();
}
static public function updateGroups() {
@ -158,7 +165,7 @@ class Jobs extends \OC\BackgroundJob\TimedJob {
}
/**
* @return \OCA\user_ldap\GROUP_LDAP|\OCA\user_ldap\Group_Proxy
* @return \OCA\User_LDAP\Group_LDAP|\OCA\User_LDAP\Group_Proxy
*/
static private function getGroupBE() {
if(!is_null(self::$groupBE)) {
@ -170,7 +177,7 @@ class Jobs extends \OC\BackgroundJob\TimedJob {
if(count($configPrefixes) === 1) {
//avoid the proxy when there is only one LDAP server configured
$dbc = \OC::$server->getDatabaseConnection();
$userManager = new user\Manager(
$userManager = new Manager(
\OC::$server->getConfig(),
new FilesystemHelper(),
new LogWrapper(),
@ -184,9 +191,9 @@ class Jobs extends \OC\BackgroundJob\TimedJob {
$userMapper = new UserMapping($dbc);
$ldapAccess->setGroupMapper($groupMapper);
$ldapAccess->setUserMapper($userMapper);
self::$groupBE = new \OCA\user_ldap\GROUP_LDAP($ldapAccess);
self::$groupBE = new \OCA\User_LDAP\Group_LDAP($ldapAccess);
} else {
self::$groupBE = new \OCA\user_ldap\Group_Proxy($configPrefixes, $ldapWrapper);
self::$groupBE = new \OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper);
}
return self::$groupBE;

View File

@ -24,7 +24,7 @@
*
*/
namespace OCA\user_ldap\lib;
namespace OCA\User_LDAP;
use OC\ServerNotAvailableException;
@ -160,7 +160,7 @@ class LDAP implements ILDAPWrapper {
/**
* @param LDAP $link
* @param resource $result
* @return mixed|an
* @return mixed
*/
public function nextEntry($link, $result) {
return $this->invokeLDAPMethod('next_entry', $link, $result);

View File

@ -21,7 +21,7 @@
*
*/
namespace OCA\user_ldap\lib;
namespace OCA\User_LDAP;
abstract class LDAPUtility {
protected $ldap;

View File

@ -20,7 +20,7 @@
*
*/
namespace OCA\user_ldap\lib;
namespace OCA\User_LDAP;
/**
* @brief wraps around static ownCloud core methods

View File

@ -26,9 +26,8 @@
*
*/
namespace OCA\user_ldap\lib;
namespace OCA\User_LDAP;
use OCA\user_ldap\lib\Access;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\User_LDAP\Mapping\GroupMapping;

View File

@ -21,7 +21,7 @@
*
*/
namespace OCA\user_ldap\lib\user;
namespace OCA\User_LDAP\User;
use OCA\User_LDAP\Mapping\UserMapping;
@ -63,7 +63,7 @@ class DeletedUsersIndex {
/**
* reads LDAP users marked as deleted from the database
* @return \OCA\user_ldap\lib\user\OfflineUser[]
* @return \OCA\User_LDAP\User\OfflineUser[]
*/
private function fetchDeletedUsers() {
$deletedUsers = $this->config->getUsersForUserValue(
@ -80,7 +80,7 @@ class DeletedUsersIndex {
/**
* returns all LDAP users that are marked as deleted
* @return \OCA\user_ldap\lib\user\OfflineUser[]
* @return \OCA\User_LDAP\User\OfflineUser[]
*/
public function getUsers() {
if(is_array($this->deletedUsers)) {

View File

@ -20,7 +20,7 @@
*
*/
namespace OCA\user_ldap\lib\user;
namespace OCA\User_LDAP\User;
/**
* IUserTools

View File

@ -23,13 +23,10 @@
*
*/
namespace OCA\user_ldap\lib\user;
namespace OCA\User_LDAP\User;
use OCA\user_ldap\lib\user\IUserTools;
use OCA\user_ldap\lib\user\User;
use OCA\user_ldap\lib\LogWrapper;
use OCA\user_ldap\lib\FilesystemHelper;
use OCA\user_ldap\lib\user\OfflineUser;
use OCA\User_LDAP\LogWrapper;
use OCA\User_LDAP\FilesystemHelper;
use OCP\IAvatarManager;
use OCP\IConfig;
use OCP\IDBConnection;
@ -65,8 +62,8 @@ class Manager {
protected $avatarManager;
/**
* array['byDN'] \OCA\user_ldap\lib\User[]
* ['byUid'] \OCA\user_ldap\lib\User[]
* array['byDN'] \OCA\User_LDAP\User\User[]
* ['byUid'] \OCA\User_LDAP\User\User[]
* @var array $users
*/
protected $users = array(
@ -76,9 +73,9 @@ class Manager {
/**
* @param IConfig $ocConfig
* @param \OCA\user_ldap\lib\FilesystemHelper $ocFilesystem object that
* @param \OCA\User_LDAP\FilesystemHelper $ocFilesystem object that
* gives access to necessary functions from the OC filesystem
* @param \OCA\user_ldap\lib\LogWrapper $ocLog
* @param \OCA\User_LDAP\LogWrapper $ocLog
* @param IAvatarManager $avatarManager
* @param Image $image an empty image instance
* @param IDBConnection $db
@ -112,7 +109,7 @@ class Manager {
* property array
* @param string $dn the DN of the user
* @param string $uid the internal (owncloud) username
* @return \OCA\user_ldap\lib\User\User
* @return \OCA\User_LDAP\User\User
*/
private function createAndCache($dn, $uid) {
$this->checkAccess();
@ -187,7 +184,7 @@ class Manager {
/**
* creates and returns an instance of OfflineUser for the specified user
* @param string $id
* @return \OCA\user_ldap\lib\user\OfflineUser
* @return \OCA\User_LDAP\User\OfflineUser
*/
public function getDeletedUser($id) {
return new OfflineUser(
@ -200,7 +197,7 @@ class Manager {
/**
* @brief returns a User object by it's ownCloud username
* @param string $id the DN or username of the user
* @return \OCA\user_ldap\lib\user\User|\OCA\user_ldap\lib\user\OfflineUser|null
* @return \OCA\User_LDAP\User\User|\OCA\User_LDAP\User\OfflineUser|null
*/
protected function createInstancyByUserName($id) {
//most likely a uid. Check whether it is a deleted user
@ -217,7 +214,7 @@ class Manager {
/**
* @brief returns a User object by it's DN or ownCloud username
* @param string $id the DN or username of the user
* @return \OCA\user_ldap\lib\user\User|\OCA\user_ldap\lib\user\OfflineUser|null
* @return \OCA\User_LDAP\User\User|\OCA\User_LDAP\User\OfflineUser|null
* @throws \Exception when connection could not be established
*/
public function get($id) {

View File

@ -21,7 +21,7 @@
*
*/
namespace OCA\user_ldap\lib\user;
namespace OCA\User_LDAP\User;
use OCA\User_LDAP\Mapping\UserMapping;

View File

@ -22,11 +22,11 @@
*
*/
namespace OCA\user_ldap\lib\user;
namespace OCA\User_LDAP\User;
use OCA\user_ldap\lib\Connection;
use OCA\user_ldap\lib\FilesystemHelper;
use OCA\user_ldap\lib\LogWrapper;
use OCA\User_LDAP\Connection;
use OCA\User_LDAP\FilesystemHelper;
use OCA\User_LDAP\LogWrapper;
use OCP\IAvatarManager;
use OCP\IConfig;
use OCP\Image;
@ -464,7 +464,7 @@ class User {
}
}
if(!is_null($quota)) {
$user = $this->userManager->get($this->uid)->setQuota($quota);
$this->userManager->get($this->uid)->setQuota($quota);
}
}
@ -502,16 +502,13 @@ class User {
*/
private function setOwnCloudAvatar() {
if(!$this->image->valid()) {
$this->log->log('user_ldap', 'jpegPhoto data invalid for '.$this->dn,
\OCP\Util::ERROR);
$this->log->log('jpegPhoto data invalid for '.$this->dn, \OCP\Util::ERROR);
return;
}
//make sure it is a square and not bigger than 128x128
$size = min(array($this->image->width(), $this->image->height(), 128));
if(!$this->image->centerCrop($size)) {
$this->log->log('user_ldap',
'croping image for avatar failed for '.$this->dn,
\OCP\Util::ERROR);
$this->log->log('croping image for avatar failed for '.$this->dn, \OCP\Util::ERROR);
return;
}

View File

@ -29,16 +29,14 @@
*
*/
namespace OCA\user_ldap;
namespace OCA\User_LDAP;
use OC\User\NoUserException;
use OCA\user_ldap\lib\BackendUtility;
use OCA\user_ldap\lib\Access;
use OCA\user_ldap\lib\user\OfflineUser;
use OCA\User_LDAP\lib\User\User;
use OCA\User_LDAP\User\OfflineUser;
use OCA\User_LDAP\User\User;
use OCP\IConfig;
class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserInterface {
class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserInterface {
/** @var string[] $homesToKill */
protected $homesToKill = array();
@ -46,7 +44,7 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
protected $ocConfig;
/**
* @param \OCA\user_ldap\lib\Access $access
* @param Access $access
* @param \OCP\IConfig $ocConfig
*/
public function __construct(Access $access, IConfig $ocConfig) {
@ -100,7 +98,7 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
public function getLDAPUserByLoginName($loginName) {
//find out dn of the user name
$attrs = $this->access->userManager->getAttributes();
$users = $this->access->fetchUsersByLoginName($loginName, $attrs, 1);
$users = $this->access->fetchUsersByLoginName($loginName, $attrs);
if(count($users) < 1) {
throw new \Exception('No user available for the given login name on ' .
$this->access->connection->ldapHost . ':' . $this->access->connection->ldapPort);
@ -201,7 +199,7 @@ class USER_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
/**
* checks whether a user is still available on LDAP
*
* @param string|\OCA\User_LDAP\lib\user\User $user either the ownCloud user
* @param string|\OCA\User_LDAP\User\User $user either the ownCloud user
* name or an instance of that user
* @return bool
* @throws \Exception

View File

@ -24,14 +24,12 @@
*
*/
namespace OCA\user_ldap;
namespace OCA\User_LDAP;
use OCA\user_ldap\lib\ILDAPWrapper;
use OCA\User_LDAP\lib\User\User;
use \OCA\user_ldap\User_LDAP;
use OCA\User_LDAP\User\User;
use OCP\IConfig;
class User_Proxy extends lib\Proxy implements \OCP\IUserBackend, \OCP\UserInterface {
class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface {
private $backends = array();
private $refBackend = null;
@ -162,7 +160,7 @@ class User_Proxy extends lib\Proxy implements \OCP\IUserBackend, \OCP\UserInterf
/**
* check if a user exists on LDAP
* @param string|\OCA\User_LDAP\lib\User\User $user either the ownCloud user
* @param string|\OCA\User_LDAP\User\User $user either the ownCloud user
* name or an instance of that user
* @return boolean
*/

View File

@ -29,11 +29,12 @@
*
*/
namespace OCA\user_ldap\lib;
namespace OCA\User_LDAP;
use OC\ServerNotAvailableException;
class Wizard extends LDAPUtility {
/** @var \OCP\IL10N */
static protected $l;
protected $access;
protected $cr;
@ -58,6 +59,7 @@ class Wizard extends LDAPUtility {
* Constructor
* @param Configuration $configuration an instance of Configuration
* @param ILDAPWrapper $ldap an instance of ILDAPWrapper
* @param Access $access
*/
public function __construct(Configuration $configuration, ILDAPWrapper $ldap, Access $access) {
parent::__construct($ldap);
@ -1032,12 +1034,12 @@ class Wizard extends LDAPUtility {
$host = $this->configuration->ldapHost;
$hostInfo = parse_url($host);
if(!$hostInfo) {
throw new \Exception($this->l->t('Invalid Host'));
throw new \Exception(self::$l->t('Invalid Host'));
}
\OCP\Util::writeLog('user_ldap', 'Wiz: Attempting to connect ', \OCP\Util::DEBUG);
$cr = $this->ldap->connect($host, $port);
if(!is_resource($cr)) {
throw new \Exception($this->l->t('Invalid Host'));
throw new \Exception(self::$l->t('Invalid Host'));
}
\OCP\Util::writeLog('user_ldap', 'Wiz: Setting LDAP Options ', \OCP\Util::DEBUG);

View File

@ -23,7 +23,7 @@
*
*/
namespace OCA\user_ldap\lib;
namespace OCA\User_LDAP;
class WizardResult {
protected $changes = array();

View File

@ -31,7 +31,7 @@ OC_Util::checkAdminUser();
// fill template
$tmpl = new OCP\Template('user_ldap', 'settings');
$helper = new \OCA\user_ldap\lib\Helper();
$helper = new \OCA\User_LDAP\Helper();
$prefixes = $helper->getServerConfigurationPrefixes();
$hosts = $helper->getServerConfigurationHosts();
@ -67,7 +67,7 @@ $tmpl->assign('toc', $toc);
$tmpl->assign('settingControls', $sControls);
// assign default values
$config = new \OCA\user_ldap\lib\Configuration('', false);
$config = new \OCA\User_LDAP\Configuration('', false);
$defaults = $config->getDefaults();
foreach($defaults as $key => $default) {
$tmpl->assign($key.'_default', $default);

View File

@ -23,39 +23,38 @@
*
*/
namespace OCA\user_ldap\tests;
namespace OCA\User_LDAP\Tests;
use \OCA\user_ldap\lib\Access;
use \OCA\user_ldap\lib\Connection;
use \OCA\user_ldap\lib\ILDAPWrapper;
use OCA\User_LDAP\Access;
use OCA\User_LDAP\Connection;
/**
* Class Test_Access
* Class AccessTest
*
* @group DB
*
* @package OCA\user_ldap\tests
* @package OCA\User_LDAP\Tests
*/
class Test_Access extends \Test\TestCase {
class AccessTest extends \Test\TestCase {
private function getConnectorAndLdapMock() {
static $conMethods;
static $accMethods;
static $umMethods;
if(is_null($conMethods) || is_null($accMethods)) {
$conMethods = get_class_methods('\OCA\user_ldap\lib\Connection');
$accMethods = get_class_methods('\OCA\user_ldap\lib\Access');
$umMethods = get_class_methods('\OCA\user_ldap\lib\user\Manager');
$conMethods = get_class_methods('\OCA\User_LDAP\Connection');
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
$umMethods = get_class_methods('\OCA\User_LDAP\User\Manager');
}
$lw = $this->getMock('\OCA\user_ldap\lib\ILDAPWrapper');
$connector = $this->getMock('\OCA\user_ldap\lib\Connection',
$lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
$connector = $this->getMock('\OCA\User_LDAP\Connection',
$conMethods,
array($lw, null, null));
$um = $this->getMock('\OCA\user_ldap\lib\user\Manager',
$um = $this->getMock('\OCA\User_LDAP\User\Manager',
$umMethods, array(
$this->getMock('\OCP\IConfig'),
$this->getMock('\OCA\user_ldap\lib\FilesystemHelper'),
$this->getMock('\OCA\user_ldap\lib\LogWrapper'),
$this->getMock('\OCA\User_LDAP\FilesystemHelper'),
$this->getMock('\OCA\User_LDAP\LogWrapper'),
$this->getMock('\OCP\IAvatarManager'),
$this->getMock('\OCP\Image'),
$this->getMock('\OCP\IDBConnection'),
@ -209,7 +208,7 @@ class Test_Access extends \Test\TestCase {
public function testStringResemblesDNLDAPmod() {
list($lw, $con, $um) = $this->getConnectorAndLdapMock();
$lw = new \OCA\user_ldap\lib\LDAP();
$lw = new \OCA\User_LDAP\LDAP();
$access = new Access($con, $lw, $um);
if(!function_exists('ldap_explode_dn')) {
@ -244,7 +243,7 @@ class Test_Access extends \Test\TestCase {
->method('getNameByDN')
->will($this->returnValue('a_username'));
$userMock = $this->getMockBuilder('\OCA\user_ldap\lib\user\User')
$userMock = $this->getMockBuilder('\OCA\User_LDAP\User\User')
->disableOriginalConstructor()
->getMock();

View File

@ -19,9 +19,9 @@
*
*/
namespace OCA\user_ldap\tests;
namespace OCA\User_LDAP\Tests;
class Test_Configuration extends \Test\TestCase {
class ConfigurationTest extends \Test\TestCase {
public function configurationDataProvider() {
$inputWithDN = array(
@ -89,7 +89,7 @@ class Test_Configuration extends \Test\TestCase {
* @dataProvider configurationDataProvider
*/
public function testSetValue($key, $input, $expected) {
$configuration = new \OCA\user_ldap\lib\Configuration('t01', false);
$configuration = new \OCA\User_LDAP\Configuration('t01', false);
$settingsInput = array(
'ldapBaseUsers' => array(

View File

@ -22,18 +22,18 @@
*
*/
namespace OCA\user_ldap\tests;
use OCA\user_ldap\lib\Connection;
namespace OCA\User_LDAP\Tests;
use OCA\User_LDAP\Connection;
/**
* Class Test_Connection
*
* @group DB
*
* @package OCA\user_ldap\tests
* @package OCA\User_LDAP\Tests
*/
class Test_Connection extends \Test\TestCase {
/** @var \OCA\user_ldap\lib\ILDAPWrapper */
class ConnectionTest extends \Test\TestCase {
/** @var \OCA\User_LDAP\ILDAPWrapper */
protected $ldap;
/** @var Connection */
@ -42,9 +42,9 @@ class Test_Connection extends \Test\TestCase {
public function setUp() {
parent::setUp();
$this->ldap = $this->getMock('\OCA\user_ldap\lib\ILDAPWrapper');
$this->ldap = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
// we use a mock here to replace the cache mechanism, due to missing DI in LDAP backend.
$this->connection = $this->getMockBuilder('OCA\user_ldap\lib\Connection')
$this->connection = $this->getMockBuilder('OCA\User_LDAP\Connection')
->setMethods(['getFromCache', 'writeToCache'])
->setConstructorArgs([$this->ldap, '', null])
->getMock();
@ -58,7 +58,7 @@ class Test_Connection extends \Test\TestCase {
//background: upon login a bind is done with the user credentials
//which is valid for the whole LDAP resource. It needs to be reset
//to the agent's credentials
$lw = $this->getMock('\OCA\user_ldap\lib\ILDAPWrapper');
$lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
$connection = new Connection($lw, '', null);
$agent = array(

View File

@ -24,37 +24,36 @@
*
*/
namespace OCA\user_ldap\tests;
namespace OCA\User_LDAP\Tests;
use \OCA\user_ldap\GROUP_LDAP as GroupLDAP;
use \OCA\user_ldap\lib\Access;
use \OCA\user_ldap\lib\Connection;
use \OCA\user_ldap\lib\ILDAPWrapper;
use OCA\User_LDAP\Group_LDAP as GroupLDAP;
use OCA\User_LDAP\Access;
use OCA\User_LDAP\Connection;
/**
* Class Test_Group_Ldap
* Class GroupLDAPTest
*
* @group DB
*
* @package OCA\user_ldap\tests
* @package OCA\User_LDAP\Tests
*/
class Test_Group_Ldap extends \Test\TestCase {
class Group_LDAPTest extends \Test\TestCase {
private function getAccessMock() {
static $conMethods;
static $accMethods;
if(is_null($conMethods) || is_null($accMethods)) {
$conMethods = get_class_methods('\OCA\user_ldap\lib\Connection');
$accMethods = get_class_methods('\OCA\user_ldap\lib\Access');
$conMethods = get_class_methods('\OCA\User_LDAP\Connection');
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
}
$lw = $this->getMock('\OCA\user_ldap\lib\ILDAPWrapper');
$connector = $this->getMock('\OCA\user_ldap\lib\Connection',
$lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
$connector = $this->getMock('\OCA\User_LDAP\Connection',
$conMethods,
array($lw, null, null));
$um = $this->getMockBuilder('\OCA\user_ldap\lib\user\Manager')
$um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager')
->disableOriginalConstructor()
->getMock();
$access = $this->getMock('\OCA\user_ldap\lib\Access',
$access = $this->getMock('\OCA\User_LDAP\Access',
$accMethods,
array($connector, $lw, $um));
@ -325,7 +324,7 @@ class Test_Group_Ldap extends \Test\TestCase {
* tests that a user listing is complete, if all it's members have the group
* as their primary.
*/
public function testUsersInGroupPrimaryMembersOnly() {
public function testUsersInGroupPrimaryMembersOnly() {
$access = $this->getAccessMock();
$this->enableGroups($access);
@ -360,7 +359,7 @@ class Test_Group_Ldap extends \Test\TestCase {
* tests that a user counting is complete, if all it's members have the group
* as their primary.
*/
public function testCountUsersInGroupPrimaryMembersOnly() {
public function testCountUsersInGroupPrimaryMembersOnly() {
$access = $this->getAccessMock();
$this->enableGroups($access);

View File

@ -19,12 +19,12 @@
*
*/
namespace OCA\user_ldap\tests\integration;
namespace OCA\User_LDAP\Tests\Integration;
use OCA\user_ldap\lib\Access;
use OCA\user_ldap\lib\Connection;
use OCA\user_ldap\lib\LDAP;
use OCA\user_ldap\lib\user\Manager;
use OCA\User_LDAP\Access;
use OCA\User_LDAP\Connection;
use OCA\User_LDAP\LDAP;
use OCA\User_LDAP\User\Manager;
abstract class AbstractIntegrationTest {
/** @var LDAP */

View File

@ -19,8 +19,11 @@
*
*/
namespace OCA\User_LDAP\Tests\Integration;
use OC\ServerNotAvailableException;
use OCA\user_ldap\lib\LDAP;
use OCA\User_LDAP\LDAP;
/**
* Class ExceptionOnLostConnection
@ -51,7 +54,7 @@ class ExceptionOnLostConnection {
/** @var string */
private $ldapHost;
/** @var OCA\user_ldap\lib\LDAP */
/** @var \OCA\User_LDAP\LDAP */
private $ldap;
/** @var bool */
@ -86,7 +89,7 @@ class ExceptionOnLostConnection {
* the LDAP backend, as well as getting information about toxiproxy.
* Also creates an instance of the LDAP class, the testee
*
* @throws Exception
* @throws \Exception
*/
public function setUp() {
require_once __DIR__ . '/../../../../lib/base.php';
@ -142,7 +145,7 @@ class ExceptionOnLostConnection {
*
* @param resource $ch
* @param mixed $result
* @throws Exception
* @throws \Exception
*/
private function checkCurlResult($ch, $result) {
if($result === false) {
@ -156,7 +159,7 @@ class ExceptionOnLostConnection {
* enables or disabled the LDAP proxy service in toxiproxy
*
* @param bool $isEnabled whether is should be enabled or disables
* @throws Exception
* @throws \Exception
*/
private function setProxyState($isEnabled) {
if(!is_bool($isEnabled)) {

View File

@ -19,16 +19,16 @@
*
*/
namespace OCA\user_ldap\tests\integration;
namespace OCA\User_LDAP\Tests\Integration;
/**
* Class FakeManager
*
* this is a mock of \OCA\user_ldap\lib\user\Manager which is a dependency of
* this is a mock of \OCA\User_LDAP\User\Manager which is a dependency of
* Access, that pulls plenty more things in. Because it is not needed in the
* scope of these tests, we replace it with a mock.
*/
class FakeManager extends \OCA\user_ldap\lib\user\Manager {
class FakeManager extends \OCA\User_LDAP\User\Manager {
public function __construct() {
$this->ocConfig = \OC::$server->getConfig();
$this->image = new \OCP\Image();

View File

@ -19,10 +19,10 @@
*
*/
namespace OCA\user_ldap\tests\integration\lib;
namespace OCA\User_LDAP\Tests\Integration\Lib;
use OCA\user_ldap\lib\Connection;
use OCA\user_ldap\tests\integration\AbstractIntegrationTest;
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
require_once __DIR__ . '/../../../../../lib/base.php';

View File

@ -19,20 +19,19 @@
*
*/
namespace OCA\user_ldap\tests\integration\lib;
namespace OCA\User_LDAP\Tests\Integration\Lib;
use OCA\user_ldap\lib\user\Manager as LDAPUserManager;
use OCA\user_ldap\tests\integration\AbstractIntegrationTest;
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\user_ldap\USER_LDAP;
use OCA\User_LDAP\User_LDAP;
require_once __DIR__ . '/../../../../../lib/base.php';
class IntegrationBackupServer extends AbstractIntegrationTest {
class IntegrationTestBackupServer extends AbstractIntegrationTest {
/** @var UserMapping */
protected $mapping;
/** @var USER_LDAP */
/** @var User_LDAP */
protected $backend;
/**
@ -113,6 +112,6 @@ class IntegrationBackupServer extends AbstractIntegrationTest {
}
require_once(__DIR__ . '/../setup-scripts/config.php');
$test = new IntegrationBackupServer($host, $port, $adn, $apwd, $bdn);
$test = new IntegrationTestBackupServer($host, $port, $adn, $apwd, $bdn);
$test->init();
$test->run();

View File

@ -19,10 +19,10 @@
*
*/
namespace OCA\user_ldap\tests\integration\lib;
namespace OCA\User_LDAP\Tests\Integration\Lib;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\user_ldap\tests\integration\AbstractIntegrationTest;
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
require_once __DIR__ . '/../../../../../lib/base.php';

View File

@ -19,20 +19,19 @@
*
*/
namespace OCA\user_ldap\tests\integration\lib;
namespace OCA\User_LDAP\Tests\Integration\Lib;
use OCA\user_ldap\lib\user\Manager as LDAPUserManager;
use OCA\user_ldap\tests\integration\AbstractIntegrationTest;
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\user_ldap\USER_LDAP;
use OCA\User_LDAP\User_LDAP;
require_once __DIR__ . '/../../../../../lib/base.php';
class IntegrationConnect extends AbstractIntegrationTest {
class IntegrationTestConnect extends AbstractIntegrationTest {
/** @var UserMapping */
protected $mapping;
/** @var USER_LDAP */
/** @var User_LDAP */
protected $backend;
/** @var string */
@ -161,6 +160,6 @@ class IntegrationConnect extends AbstractIntegrationTest {
}
require_once(__DIR__ . '/../setup-scripts/config.php');
$test = new IntegrationConnect($host, $port, $adn, $apwd, $bdn);
$test = new IntegrationTestConnect($host, $port, $adn, $apwd, $bdn);
$test->init();
$test->run();

View File

@ -19,16 +19,13 @@
*
*/
namespace OCA\user_ldap\tests\integration\lib;
namespace OCA\User_LDAP\Tests\Integration\Lib;
use OCA\user_ldap\lib\user\Manager as LDAPUserManager;
use OCA\user_ldap\tests\integration\AbstractIntegrationTest;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\user_ldap\USER_LDAP;
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
require_once __DIR__ . '/../../../../../lib/base.php';
class IntegrationTestUserHome extends AbstractIntegrationTest {
class IntegrationTestCountUsersByLoginName extends AbstractIntegrationTest {
/**
* prepares the LDAP environment and sets up a test configuration for
@ -63,6 +60,6 @@ class IntegrationTestUserHome extends AbstractIntegrationTest {
}
require_once(__DIR__ . '/../setup-scripts/config.php');
$test = new IntegrationTestUserHome($host, $port, $adn, $apwd, $bdn);
$test = new IntegrationTestCountUsersByLoginName($host, $port, $adn, $apwd, $bdn);
$test->init();
$test->run();

View File

@ -19,20 +19,19 @@
*
*/
namespace OCA\user_ldap\tests\integration\lib;
namespace OCA\User_LDAP\Tests\Integration\Lib;
use OCA\user_ldap\lib\user\Manager as LDAPUserManager;
use OCA\user_ldap\tests\integration\AbstractIntegrationTest;
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\user_ldap\USER_LDAP;
use OCA\User_LDAP\User_LDAP;
require_once __DIR__ . '/../../../../../lib/base.php';
class IntegrationTestUserHome extends AbstractIntegrationTest {
class IntegrationTestFetchUsersByLoginName extends AbstractIntegrationTest {
/** @var UserMapping */
protected $mapping;
/** @var USER_LDAP */
/** @var User_LDAP */
protected $backend;
/**
@ -46,7 +45,7 @@ class IntegrationTestUserHome extends AbstractIntegrationTest {
$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());
$this->backend = new \OCA\User_LDAP\User_LDAP($this->access, \OC::$server->getConfig());
}
/**
@ -74,6 +73,6 @@ class IntegrationTestUserHome extends AbstractIntegrationTest {
}
require_once(__DIR__ . '/../setup-scripts/config.php');
$test = new IntegrationTestUserHome($host, $port, $adn, $apwd, $bdn);
$test = new IntegrationTestFetchUsersByLoginName($host, $port, $adn, $apwd, $bdn);
$test->init();
$test->run();

View File

@ -19,12 +19,11 @@
*
*/
namespace OCA\user_ldap\tests\integration\lib;
namespace OCA\User_LDAP\Tests\Integration\Lib;
use OCA\user_ldap\lib\user\Manager as LDAPUserManager;
use OCA\user_ldap\tests\integration\AbstractIntegrationTest;
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\user_ldap\USER_LDAP;
use OCA\User_LDAP\User_LDAP;
require_once __DIR__ . '/../../../../../lib/base.php';
@ -32,7 +31,7 @@ class IntegrationTestPaging extends AbstractIntegrationTest {
/** @var UserMapping */
protected $mapping;
/** @var USER_LDAP */
/** @var User_LDAP */
protected $backend;
/**
@ -43,7 +42,7 @@ class IntegrationTestPaging extends AbstractIntegrationTest {
require(__DIR__ . '/../setup-scripts/createExplicitUsers.php');
parent::init();
$this->backend = new \OCA\user_ldap\USER_LDAP($this->access, \OC::$server->getConfig());
$this->backend = new \OCA\User_LDAP\User_LDAP($this->access, \OC::$server->getConfig());
}
/**

View File

@ -19,12 +19,12 @@
*
*/
namespace OCA\user_ldap\tests\integration\lib;
namespace OCA\User_LDAP\Tests\Integration\Lib;
use OCA\user_ldap\lib\user\Manager as LDAPUserManager;
use OCA\user_ldap\tests\integration\AbstractIntegrationTest;
use OCA\User_LDAP\User\Manager as LDAPUserManager;
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\user_ldap\USER_LDAP;
use OCA\User_LDAP\User_LDAP;
require_once __DIR__ . '/../../../../../lib/base.php';
@ -32,7 +32,7 @@ class IntegrationTestUserHome extends AbstractIntegrationTest {
/** @var UserMapping */
protected $mapping;
/** @var USER_LDAP */
/** @var User_LDAP */
protected $backend;
/**
@ -46,7 +46,7 @@ class IntegrationTestUserHome extends AbstractIntegrationTest {
$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());
$this->backend = new \OCA\User_LDAP\User_LDAP($this->access, \OC::$server->getConfig());
}
/**
@ -66,11 +66,12 @@ class IntegrationTestUserHome extends AbstractIntegrationTest {
protected function initUserManager() {
$this->userManager = new LDAPUserManager(
\OC::$server->getConfig(),
new \OCA\user_ldap\lib\FilesystemHelper(),
new \OCA\user_ldap\lib\LogWrapper(),
new \OCA\User_LDAP\FilesystemHelper(),
new \OCA\User_LDAP\LogWrapper(),
\OC::$server->getAvatarManager(),
new \OCP\Image(),
\OC::$server->getDatabaseConnection()
\OC::$server->getDatabaseConnection(),
\OC::$server->getUserManager()
);
}
@ -82,7 +83,7 @@ class IntegrationTestUserHome extends AbstractIntegrationTest {
*/
protected function case1() {
\OC::$server->getConfig()->setAppValue('user_ldap', 'enforce_home_folder_naming_rule', false);
$userManager = \oc::$server->getUserManager();
$userManager = \OC::$server->getUserManager();
$userManager->clearBackends();
$userManager->registerBackend($this->backend);
$users = $userManager->search('', 5, 0);

View File

@ -20,9 +20,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
use OCA\user_ldap\lib\user\User;
namespace OCA\User_LDAP\Tests\Integration\Lib\User;
use OCA\User_LDAP\User\User;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\user_ldap\tests\integration\AbstractIntegrationTest;
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
require_once __DIR__ . '/../../../../../../lib/base.php';
@ -40,7 +43,7 @@ class IntegrationTestUserAvatar extends AbstractIntegrationTest {
$this->mapping = new UserMapping(\OC::$server->getDatabaseConnection());
$this->mapping->clear();
$this->access->setUserMapper($this->mapping);
$userBackend = new OCA\user_ldap\USER_LDAP($this->access, \OC::$server->getConfig());
$userBackend = new \OCA\User_LDAP\User_LDAP($this->access, \OC::$server->getConfig());
\OC_User::useBackend($userBackend);
}
@ -118,10 +121,10 @@ class IntegrationTestUserAvatar extends AbstractIntegrationTest {
}
protected function initUserManager() {
$this->userManager = new \OCA\user_ldap\lib\user\Manager(
$this->userManager = new \OCA\User_LDAP\User\Manager(
\OC::$server->getConfig(),
new \OCA\user_ldap\lib\FilesystemHelper(),
new \OCA\user_ldap\lib\LogWrapper(),
new \OCA\User_LDAP\FilesystemHelper(),
new \OCA\User_LDAP\LogWrapper(),
\OC::$server->getAvatarManager(),
new \OCP\Image(),
\OC::$server->getDatabaseConnection(),

View File

@ -18,9 +18,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
use OCA\user_ldap\lib\user\User;
namespace OCA\User_LDAP\Tests\Integration\Lib\User;
use OCA\User_LDAP\Mapping\UserMapping;
use OCA\user_ldap\tests\integration\AbstractIntegrationTest;
use OCA\User_LDAP\Tests\Integration\AbstractIntegrationTest;
require_once __DIR__ . '/../../../../../../lib/base.php';
@ -38,7 +40,7 @@ class IntegrationTestUserDisplayName extends AbstractIntegrationTest {
$this->mapping = new UserMapping(\OC::$server->getDatabaseConnection());
$this->mapping->clear();
$this->access->setUserMapper($this->mapping);
$userBackend = new OCA\user_ldap\USER_LDAP($this->access, \OC::$server->getConfig());
$userBackend = new \OCA\User_LDAP\User_LDAP($this->access, \OC::$server->getConfig());
\OC_User::useBackend($userBackend);
}

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

Before

Width:  |  Height:  |  Size: 93 KiB

After

Width:  |  Height:  |  Size: 93 KiB

View File

@ -20,22 +20,22 @@
*
*/
namespace OCA\user_ldap\tests;
namespace OCA\User_LDAP\Tests\Jobs;
class Test_CleanUp extends \PHPUnit_Framework_TestCase {
class CleanUpTest extends \Test\TestCase {
public function getMocks() {
$mocks = array();
$mocks['userBackend'] =
$this->getMockBuilder('\OCA\user_ldap\User_Proxy')
$this->getMockBuilder('\OCA\User_LDAP\User_Proxy')
->disableOriginalConstructor()
->getMock();
$mocks['deletedUsersIndex'] =
$this->getMockBuilder('\OCA\user_ldap\lib\user\deletedUsersIndex')
$this->getMockBuilder('\OCA\User_LDAP\User\DeletedUsersIndex')
->disableOriginalConstructor()
->getMock();
$mocks['ocConfig'] = $this->getMock('\OCP\IConfig');
$mocks['db'] = $this->getMock('\OCP\IDBConnection');
$mocks['helper'] = $this->getMock('\OCA\user_ldap\lib\Helper');
$mocks['helper'] = $this->getMock('\OCA\User_LDAP\Helper');
return $mocks;
}

View File

@ -20,7 +20,7 @@
*
*/
namespace OCA\user_ldap\tests\mapping;
namespace OCA\User_LDAP\Tests\Mapping;
abstract class AbstractMappingTest extends \Test\TestCase {
abstract public function getMapper(\OCP\IDBConnection $dbMock);

View File

@ -21,18 +21,18 @@
*
*/
namespace OCA\user_ldap\tests\mapping;
namespace OCA\User_LDAP\Tests\Mapping;
use OCA\User_LDAP\Mapping\GroupMapping;
/**
* Class Test_GroupMapping
* Class GroupMappingTest
*
* @group DB
*
* @package OCA\user_ldap\tests\mapping
* @package OCA\User_LDAP\Tests\Mapping
*/
class Test_GroupMapping extends AbstractMappingTest {
class GroupMappingTest extends AbstractMappingTest {
public function getMapper(\OCP\IDBConnection $dbMock) {
return new GroupMapping($dbMock);
}

View File

@ -21,18 +21,18 @@
*
*/
namespace OCA\user_ldap\tests\mapping;
namespace OCA\User_LDAP\Tests\Mapping;
use OCA\User_LDAP\Mapping\UserMapping;
/**
* Class Test_UserMapping
* Class UserMappingTest
*
* @group DB
*
* @package OCA\user_ldap\tests\mapping
* @package OCA\User_LDAP\Tests\Mapping
*/
class Test_UserMapping extends AbstractMappingTest {
class UserMappingTest extends AbstractMappingTest {
public function getMapper(\OCP\IDBConnection $dbMock) {
return new UserMapping($dbMock);
}

View File

@ -23,31 +23,31 @@
*
*/
namespace OCA\user_ldap\tests;
namespace OCA\User_LDAP\Tests\User;
use OCA\user_ldap\lib\user\Manager;
use OCA\User_LDAP\User\Manager;
/**
* Class Test_User_Manager
*
* @group DB
*
* @package OCA\user_ldap\tests
* @package OCA\User_LDAP\Tests\User
*/
class Test_User_Manager extends \Test\TestCase {
class ManagerTest extends \Test\TestCase {
private function getTestInstances() {
$access = $this->getMock('\OCA\user_ldap\lib\user\IUserTools');
$access = $this->getMock('\OCA\User_LDAP\User\IUserTools');
$config = $this->getMock('\OCP\IConfig');
$filesys = $this->getMock('\OCA\user_ldap\lib\FilesystemHelper');
$log = $this->getMock('\OCA\user_ldap\lib\LogWrapper');
$filesys = $this->getMock('\OCA\User_LDAP\FilesystemHelper');
$log = $this->getMock('\OCA\User_LDAP\LogWrapper');
$avaMgr = $this->getMock('\OCP\IAvatarManager');
$image = $this->getMock('\OCP\Image');
$dbc = $this->getMock('\OCP\IDBConnection');
$userMgr = $this->getMock('\OCP\IUserManager');
$connection = new \OCA\user_ldap\lib\Connection(
$lw = $this->getMock('\OCA\user_ldap\lib\ILDAPWrapper'),
$connection = new \OCA\User_LDAP\Connection(
$lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper'),
'',
null
);
@ -87,7 +87,7 @@ class Test_User_Manager extends \Test\TestCase {
// runtime caching the manager is broken.
$user = $manager->get($inputDN);
$this->assertInstanceOf('\OCA\user_ldap\lib\user\User', $user);
$this->assertInstanceOf('\OCA\User_LDAP\User\User', $user);
}
public function testGetByEDirectoryDN() {
@ -114,7 +114,7 @@ class Test_User_Manager extends \Test\TestCase {
$manager->setLdapAccess($access);
$user = $manager->get($inputDN);
$this->assertInstanceOf('\OCA\user_ldap\lib\user\User', $user);
$this->assertInstanceOf('\OCA\User_LDAP\User\User', $user);
}
public function testGetByExoticDN() {
@ -141,7 +141,7 @@ class Test_User_Manager extends \Test\TestCase {
$manager->setLdapAccess($access);
$user = $manager->get($inputDN);
$this->assertInstanceOf('\OCA\user_ldap\lib\user\User', $user);
$this->assertInstanceOf('\OCA\User_LDAP\User\User', $user);
}
public function testGetByDNNotExisting() {
@ -200,7 +200,7 @@ class Test_User_Manager extends \Test\TestCase {
// runtime caching the manager is broken.
$user = $manager->get($uid);
$this->assertInstanceOf('\OCA\user_ldap\lib\user\User', $user);
$this->assertInstanceOf('\OCA\User_LDAP\User\User', $user);
}
public function testGetByUidNotExisting() {

View File

@ -22,25 +22,25 @@
*
*/
namespace OCA\user_ldap\tests;
namespace OCA\User_LDAP\Tests\User;
use OCA\user_ldap\lib\user\User;
use OCA\User_LDAP\User\User;
use OCP\IUserManager;
/**
* Class Test_User_User
* Class UserTest
*
* @group DB
*
* @package OCA\user_ldap\tests
* @package OCA\User_LDAP\Tests\User
*/
class Test_User_User extends \Test\TestCase {
class UserTest extends \Test\TestCase {
private function getTestInstances() {
$access = $this->getMock('\OCA\user_ldap\lib\user\IUserTools');
$access = $this->getMock('\OCA\User_LDAP\User\IUserTools');
$config = $this->getMock('\OCP\IConfig');
$filesys = $this->getMock('\OCA\user_ldap\lib\FilesystemHelper');
$log = $this->getMock('\OCA\user_ldap\lib\LogWrapper');
$filesys = $this->getMock('\OCA\User_LDAP\FilesystemHelper');
$log = $this->getMock('\OCA\User_LDAP\LogWrapper');
$avaMgr = $this->getMock('\OCP\IAvatarManager');
$image = $this->getMock('\OCP\Image');
$dbc = $this->getMock('\OCP\IDBConnection');
@ -55,22 +55,22 @@ class Test_User_User extends \Test\TestCase {
static $umMethods;
if(is_null($conMethods) || is_null($accMethods)) {
$conMethods = get_class_methods('\OCA\user_ldap\lib\Connection');
$accMethods = get_class_methods('\OCA\user_ldap\lib\Access');
$conMethods = get_class_methods('\OCA\User_LDAP\Connection');
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
//getConnection shall not be replaced
unset($accMethods[array_search('getConnection', $accMethods)]);
$umMethods = get_class_methods('\OCA\user_ldap\lib\user\Manager');
$umMethods = get_class_methods('\OCA\User_LDAP\User\Manager');
}
$lw = $this->getMock('\OCA\user_ldap\lib\ILDAPWrapper');
$lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
$im = $this->getMock('\OCP\Image');
if (is_null($userMgr)) {
$userMgr = $this->getMock('\OCP\IUserManager');
}
$um = $this->getMock('\OCA\user_ldap\lib\user\Manager',
$um = $this->getMock('\OCA\User_LDAP\User\Manager',
$umMethods, array($cfMock, $fsMock, $logMock, $avaMgr, $im, $dbc, $userMgr));
$connector = $this->getMock('\OCA\user_ldap\lib\Connection',
$connector = $this->getMock('\OCA\User_LDAP\Connection',
$conMethods, array($lw, null, null));
$access = $this->getMock('\OCA\user_ldap\lib\Access',
$access = $this->getMock('\OCA\User_LDAP\Access',
$accMethods, array($connector, $lw, $um));
return array($access, $connector);
@ -763,7 +763,7 @@ class Test_User_User extends \Test\TestCase {
'updateAvatar'
);
$userMock = $this->getMockBuilder('OCA\user_ldap\lib\user\User')
$userMock = $this->getMockBuilder('OCA\User_LDAP\User\User')
->setConstructorArgs(array($uid, $dn, $access, $config, $filesys, $image, $log, $avaMgr, $userMgr))
->setMethods($requiredMethods)
->getMock();

View File

@ -25,21 +25,20 @@
*
*/
namespace OCA\user_ldap\tests;
namespace OCA\User_LDAP\Tests;
use \OCA\user_ldap\USER_LDAP as UserLDAP;
use \OCA\user_ldap\lib\Access;
use \OCA\user_ldap\lib\Connection;
use \OCA\user_ldap\lib\ILDAPWrapper;
use OCA\User_LDAP\User_LDAP as UserLDAP;
use \OCA\User_LDAP\Access;
use \OCA\User_LDAP\Connection;
/**
* Class Test_User_Ldap_Direct
*
* @group DB
*
* @package OCA\user_ldap\tests
* @package OCA\User_LDAP\Tests
*/
class Test_User_Ldap_Direct extends \Test\TestCase {
class User_LDAPTest extends \Test\TestCase {
protected $backend;
protected $access;
protected $configMock;
@ -57,31 +56,31 @@ class Test_User_Ldap_Direct extends \Test\TestCase {
static $uMethods;
if(is_null($conMethods) || is_null($accMethods)) {
$conMethods = get_class_methods('\OCA\user_ldap\lib\Connection');
$accMethods = get_class_methods('\OCA\user_ldap\lib\Access');
$conMethods = get_class_methods('\OCA\User_LDAP\Connection');
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
unset($accMethods[array_search('getConnection', $accMethods)]);
$uMethods = get_class_methods('\OCA\user_ldap\lib\user\User');
$uMethods = get_class_methods('\OCA\User_LDAP\User\User');
unset($uMethods[array_search('getUsername', $uMethods)]);
unset($uMethods[array_search('getDN', $uMethods)]);
unset($uMethods[array_search('__construct', $uMethods)]);
}
$lw = $this->getMock('\OCA\user_ldap\lib\ILDAPWrapper');
$connector = $this->getMock('\OCA\user_ldap\lib\Connection',
$lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
$connector = $this->getMock('\OCA\User_LDAP\Connection',
$conMethods,
array($lw, null, null));
$this->configMock = $this->getMock('\OCP\IConfig');
$offlineUser = $this->getMockBuilder('\OCA\user_ldap\lib\user\OfflineUser')
$offlineUser = $this->getMockBuilder('\OCA\User_LDAP\User\OfflineUser')
->disableOriginalConstructor()
->getMock();
$um = $this->getMockBuilder('\OCA\user_ldap\lib\user\Manager')
$um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager')
->setMethods(['getDeletedUser'])
->setConstructorArgs([
$this->configMock,
$this->getMock('\OCA\user_ldap\lib\FilesystemHelper'),
$this->getMock('\OCA\user_ldap\lib\LogWrapper'),
$this->getMock('\OCA\User_LDAP\FilesystemHelper'),
$this->getMock('\OCA\User_LDAP\LogWrapper'),
$this->getMock('\OCP\IAvatarManager'),
$this->getMock('\OCP\Image'),
$this->getMock('\OCP\IDBConnection'),
@ -93,7 +92,7 @@ class Test_User_Ldap_Direct extends \Test\TestCase {
->method('getDeletedUser')
->will($this->returnValue($offlineUser));
$access = $this->getMock('\OCA\user_ldap\lib\Access',
$access = $this->getMock('\OCA\User_LDAP\Access',
$accMethods,
array($connector, $lw, $um));
@ -127,8 +126,8 @@ class Test_User_Ldap_Direct extends \Test\TestCase {
/**
* Prepares the Access mock for checkPassword tests
* @param \OCA\user_ldap\lib\Access $access mock
* @param bool noDisplayName
* @param \OCA\User_LDAP\Access $access mock
* @param bool $noDisplayName
* @return void
*/
private function prepareAccessForCheckPassword(&$access, $noDisplayName = false) {
@ -296,7 +295,7 @@ class Test_User_Ldap_Direct extends \Test\TestCase {
/**
* Prepares the Access mock for getUsers tests
* @param \OCA\user_ldap\lib\Access $access mock
* @param \OCA\User_LDAP\Access $access mock
* @return void
*/
private function prepareAccessForGetUsers(&$access) {

View File

@ -23,23 +23,18 @@
*
*/
namespace OCA\user_ldap\tests;
namespace OCA\User_LDAP\Tests;
use \OCA\user_ldap\lib\Wizard;
// use \OCA\user_ldap\USER_LDAP as UserLDAP;
// use \OCA\user_ldap\lib\Access;
// use \OCA\user_ldap\lib\Configuration;
// use \OCA\user_ldap\lib\ILDAPWrapper;
use \OCA\User_LDAP\Wizard;
/**
* Class Test_Wizard
*
* @group DB
*
* @package OCA\user_ldap\tests
* @package OCA\User_LDAP\Tests
*/
class Test_Wizard extends \Test\TestCase {
class WizardTest extends \Test\TestCase {
protected function setUp() {
parent::setUp();
//we need to make sure the consts are defined, otherwise tests will fail
@ -59,21 +54,21 @@ class Test_Wizard extends \Test\TestCase {
static $accMethods;
if(is_null($confMethods)) {
$confMethods = get_class_methods('\OCA\user_ldap\lib\Configuration');
$connMethods = get_class_methods('\OCA\user_ldap\lib\Connection');
$accMethods = get_class_methods('\OCA\user_ldap\lib\Access');
$confMethods = get_class_methods('\OCA\User_LDAP\Configuration');
$connMethods = get_class_methods('\OCA\User_LDAP\Connection');
$accMethods = get_class_methods('\OCA\User_LDAP\Access');
}
$lw = $this->getMock('\OCA\user_ldap\lib\ILDAPWrapper');
$conf = $this->getMock('\OCA\user_ldap\lib\Configuration',
$lw = $this->getMock('\OCA\User_LDAP\ILDAPWrapper');
$conf = $this->getMock('\OCA\User_LDAP\Configuration',
$confMethods,
array($lw, null, null));
$connector = $this->getMock('\OCA\user_ldap\lib\Connection',
$connector = $this->getMock('\OCA\User_LDAP\Connection',
$connMethods, array($lw, null, null));
$um = $this->getMockBuilder('\OCA\user_ldap\lib\user\Manager')
$um = $this->getMockBuilder('\OCA\User_LDAP\User\Manager')
->disableOriginalConstructor()
->getMock();
$access = $this->getMock('\OCA\user_ldap\lib\Access',
$access = $this->getMock('\OCA\User_LDAP\Access',
$accMethods, array($connector, $lw, $um));
return array(new Wizard($conf, $lw, $access), $conf, $lw, $access);

View File

@ -73,8 +73,12 @@ class DropOldJobs implements IRepairStep {
['class' => 'OC_Cache_FileGlobalGC', 'arguments' => null],
['class' => 'OC\Cache\FileGlobalGC', 'arguments' => null],
['class' => 'OCA\Files\BackgroundJob\DeleteOrphanedTagsJob', 'arguments' => null],
['class' => 'OCA\Files_sharing\Lib\DeleteOrphanedSharesJob', 'arguments' => null],
['class' => 'OCA\Files_sharing\ExpireSharesJob', 'arguments' => null],
['class' => 'OCA\user_ldap\lib\Jobs', 'arguments' => null],
['class' => '\OCA\User_LDAP\Jobs\CleanUp', 'arguments' => null],
];
}

View File

@ -46,8 +46,8 @@ $sortGroupsBy = \OC\Group\MetaData::SORT_USERCOUNT;
if (\OC_App::isEnabled('user_ldap')) {
$isLDAPUsed =
$groupManager->isBackendUsed('\OCA\user_ldap\GROUP_LDAP')
|| $groupManager->isBackendUsed('\OCA\user_ldap\Group_Proxy');
$groupManager->isBackendUsed('\OCA\User_LDAP\Group_LDAP')
|| $groupManager->isBackendUsed('\OCA\User_LDAP\Group_Proxy');
if ($isLDAPUsed) {
// LDAP user count can be slow, so we sort by group name here
$sortGroupsBy = \OC\Group\MetaData::SORT_GROUPNAME;

View File

@ -10,6 +10,9 @@ function loadDirectory($path) {
if (strpos($path, 'integration')) {
return;
}
if (strpos($path, 'Integration')) {
return;
}
if ($dh = opendir($path)) {
while ($name = readdir($dh)) {
if ($name[0] !== '.') {