Example #1
0
OCP\JSON::callCheck();
$l = \OC::$server->getL10N('user_ldap');
if (!isset($_POST['action'])) {
    \OCP\JSON::error(array('message' => $l->t('No action specified')));
}
$action = (string) $_POST['action'];
if (!isset($_POST['ldap_serverconfig_chooser'])) {
    \OCP\JSON::error(array('message' => $l->t('No configuration specified')));
}
$prefix = (string) $_POST['ldap_serverconfig_chooser'];
$ldapWrapper = new \OCA\user_ldap\lib\LDAP();
$configuration = new \OCA\user_ldap\lib\Configuration($prefix);
$con = new \OCA\user_ldap\lib\Connection($ldapWrapper, '', null);
$con->setConfiguration($configuration->getConfiguration());
$con->ldapConfigurationActive = true;
$con->setIgnoreValidation(true);
$userManager = new \OCA\user_ldap\lib\user\Manager(\OC::$server->getConfig(), new \OCA\user_ldap\lib\FilesystemHelper(), new \OCA\user_ldap\lib\LogWrapper(), \OC::$server->getAvatarManager(), new \OCP\Image(), \OC::$server->getDatabaseConnection());
$access = new \OCA\user_ldap\lib\Access($con, $ldapWrapper, $userManager);
$wizard = new \OCA\user_ldap\lib\Wizard($configuration, $ldapWrapper, $access);
switch ($action) {
    case 'guessPortAndTLS':
    case 'guessBaseDN':
    case 'detectEmailAttribute':
    case 'detectUserDisplayNameAttribute':
    case 'determineGroupMemberAssoc':
    case 'determineUserObjectClasses':
    case 'determineGroupObjectClasses':
    case 'determineGroupsForUsers':
    case 'determineGroupsForGroups':
    case 'determineAttributes':
    case 'getUserListFilter':