Completed
Pull Request — master (#3218)
by Vars
46:46 queued 34:29
created
apps/user_ldap/lib/Migration/UUIDFixInsert.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -32,70 +32,70 @@
 block discarded – undo
32 32
 
33 33
 class UUIDFixInsert implements IRepairStep {
34 34
 
35
-	/** @var IConfig */
36
-	protected $config;
35
+    /** @var IConfig */
36
+    protected $config;
37 37
 
38
-	/** @var UserMapping */
39
-	protected $userMapper;
38
+    /** @var UserMapping */
39
+    protected $userMapper;
40 40
 
41
-	/** @var GroupMapping */
42
-	protected $groupMapper;
41
+    /** @var GroupMapping */
42
+    protected $groupMapper;
43 43
 
44
-	/** @var IJobList */
45
-	protected $jobList;
44
+    /** @var IJobList */
45
+    protected $jobList;
46 46
 
47
-	public function __construct(IConfig $config, UserMapping $userMapper, GroupMapping $groupMapper, IJobList $jobList) {
48
-		$this->config = $config;
49
-		$this->userMapper = $userMapper;
50
-		$this->groupMapper = $groupMapper;
51
-		$this->jobList = $jobList;
52
-	}
47
+    public function __construct(IConfig $config, UserMapping $userMapper, GroupMapping $groupMapper, IJobList $jobList) {
48
+        $this->config = $config;
49
+        $this->userMapper = $userMapper;
50
+        $this->groupMapper = $groupMapper;
51
+        $this->jobList = $jobList;
52
+    }
53 53
 
54
-	/**
55
-	 * Returns the step's name
56
-	 *
57
-	 * @return string
58
-	 * @since 9.1.0
59
-	 */
60
-	public function getName() {
61
-		return 'Insert UUIDFix background job for user and group in batches';
62
-	}
54
+    /**
55
+     * Returns the step's name
56
+     *
57
+     * @return string
58
+     * @since 9.1.0
59
+     */
60
+    public function getName() {
61
+        return 'Insert UUIDFix background job for user and group in batches';
62
+    }
63 63
 
64
-	/**
65
-	 * Run repair step.
66
-	 * Must throw exception on error.
67
-	 *
68
-	 * @param IOutput $output
69
-	 * @throws \Exception in case of failure
70
-	 * @since 9.1.0
71
-	 */
72
-	public function run(IOutput $output) {
73
-		$installedVersion = $this->config->getAppValue('user_ldap', 'installed_version', '1.2.1');
74
-		if(version_compare($installedVersion, '1.2.1') !== -1) {
75
-			return;
76
-		}
64
+    /**
65
+     * Run repair step.
66
+     * Must throw exception on error.
67
+     *
68
+     * @param IOutput $output
69
+     * @throws \Exception in case of failure
70
+     * @since 9.1.0
71
+     */
72
+    public function run(IOutput $output) {
73
+        $installedVersion = $this->config->getAppValue('user_ldap', 'installed_version', '1.2.1');
74
+        if(version_compare($installedVersion, '1.2.1') !== -1) {
75
+            return;
76
+        }
77 77
 
78
-		foreach ([$this->userMapper, $this->groupMapper] as $mapper) {
79
-			$offset = 0;
80
-			$batchSize = 50;
81
-			$jobClass = $mapper instanceof UserMapping ? UUIDFixUser::class : UUIDFixGroup::class;
82
-			do {
83
-				$retry = false;
84
-				$records = $mapper->getList($offset, $batchSize);
85
-				if(count($records) === 0){
86
-					continue;
87
-				}
88
-				try {
89
-					$this->jobList->add($jobClass, ['records' => $records]);
90
-					$offset += $batchSize;
91
-				} catch (\InvalidArgumentException $e) {
92
-					if(strpos($e->getMessage(), 'Background job arguments can\'t exceed 4000') !== false) {
93
-						$batchSize = intval(floor(count($records) * 0.8));
94
-						$retry = true;
95
-					}
96
-				}
97
-			} while (count($records) === $batchSize || $retry);
98
-		}
78
+        foreach ([$this->userMapper, $this->groupMapper] as $mapper) {
79
+            $offset = 0;
80
+            $batchSize = 50;
81
+            $jobClass = $mapper instanceof UserMapping ? UUIDFixUser::class : UUIDFixGroup::class;
82
+            do {
83
+                $retry = false;
84
+                $records = $mapper->getList($offset, $batchSize);
85
+                if(count($records) === 0){
86
+                    continue;
87
+                }
88
+                try {
89
+                    $this->jobList->add($jobClass, ['records' => $records]);
90
+                    $offset += $batchSize;
91
+                } catch (\InvalidArgumentException $e) {
92
+                    if(strpos($e->getMessage(), 'Background job arguments can\'t exceed 4000') !== false) {
93
+                        $batchSize = intval(floor(count($records) * 0.8));
94
+                        $retry = true;
95
+                    }
96
+                }
97
+            } while (count($records) === $batchSize || $retry);
98
+        }
99 99
 
100
-	}
100
+    }
101 101
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Migration/UUIDFixGroup.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@
 block discarded – undo
30 30
 use OCP\IConfig;
31 31
 
32 32
 class UUIDFixGroup extends UUIDFix {
33
-	public function __construct(GroupMapping $mapper, LDAP $ldap, IConfig $config, Helper $helper) {
34
-		$this->mapper = $mapper;
35
-		$this->proxy = new User_Proxy($helper->getServerConfigurationPrefixes(true), $ldap, $config);
36
-	}
33
+    public function __construct(GroupMapping $mapper, LDAP $ldap, IConfig $config, Helper $helper) {
34
+        $this->mapper = $mapper;
35
+        $this->proxy = new User_Proxy($helper->getServerConfigurationPrefixes(true), $ldap, $config);
36
+    }
37 37
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Migration/UUIDFixUser.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@
 block discarded – undo
30 30
 use OCP\IConfig;
31 31
 
32 32
 class UUIDFixUser extends UUIDFix {
33
-	public function __construct(UserMapping $mapper, LDAP $ldap, IConfig $config, Helper $helper) {
34
-		$this->mapper = $mapper;
35
-		$this->proxy = new Group_Proxy($helper->getServerConfigurationPrefixes(true), $ldap, $config);
36
-	}
33
+    public function __construct(UserMapping $mapper, LDAP $ldap, IConfig $config, Helper $helper) {
34
+        $this->mapper = $mapper;
35
+        $this->proxy = new Group_Proxy($helper->getServerConfigurationPrefixes(true), $ldap, $config);
36
+    }
37 37
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Migration/UUIDFix.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -30,31 +30,31 @@
 block discarded – undo
30 30
 use OCA\User_LDAP\User_Proxy;
31 31
 
32 32
 abstract class UUIDFix extends QueuedJob {
33
-	/** @var  AbstractMapping */
34
-	protected $mapper;
33
+    /** @var  AbstractMapping */
34
+    protected $mapper;
35 35
 
36
-	/** @var  Proxy */
37
-	protected $proxy;
36
+    /** @var  Proxy */
37
+    protected $proxy;
38 38
 
39
-	public function run($argument) {
40
-		$isUser = $this->proxy instanceof User_Proxy;
41
-		foreach($argument['records'] as $record) {
42
-			$access = $this->proxy->getLDAPAccess($record['name']);
43
-			$uuid = $access->getUUID($record['dn'], $isUser);
44
-			if($uuid === false) {
45
-				// record not found, no prob, continue with the next
46
-				continue;
47
-			}
48
-			if($uuid !== $record['uuid']) {
49
-				$this->mapper->setUUIDbyDN($uuid, $record['dn']);
50
-			}
51
-		}
52
-	}
39
+    public function run($argument) {
40
+        $isUser = $this->proxy instanceof User_Proxy;
41
+        foreach($argument['records'] as $record) {
42
+            $access = $this->proxy->getLDAPAccess($record['name']);
43
+            $uuid = $access->getUUID($record['dn'], $isUser);
44
+            if($uuid === false) {
45
+                // record not found, no prob, continue with the next
46
+                continue;
47
+            }
48
+            if($uuid !== $record['uuid']) {
49
+                $this->mapper->setUUIDbyDN($uuid, $record['dn']);
50
+            }
51
+        }
52
+    }
53 53
 
54
-	/**
55
-	 * @param Proxy $proxy
56
-	 */
57
-	public function overrideProxy(Proxy $proxy) {
58
-		$this->proxy = $proxy;
59
-	}
54
+    /**
55
+     * @param Proxy $proxy
56
+     */
57
+    public function overrideProxy(Proxy $proxy) {
58
+        $this->proxy = $proxy;
59
+    }
60 60
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Command/CheckUser.php 1 patch
Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -36,101 +36,101 @@
 block discarded – undo
36 36
 use OCA\User_LDAP\User_Proxy;
37 37
 
38 38
 class CheckUser extends Command {
39
-	/** @var \OCA\User_LDAP\User_Proxy */
40
-	protected $backend;
41
-
42
-	/** @var \OCA\User_LDAP\Helper */
43
-	protected $helper;
44
-
45
-	/** @var \OCA\User_LDAP\User\DeletedUsersIndex */
46
-	protected $dui;
47
-
48
-	/** @var \OCA\User_LDAP\Mapping\UserMapping */
49
-	protected $mapping;
50
-
51
-	/**
52
-	 * @param User_Proxy $uBackend
53
-	 * @param LDAPHelper $helper
54
-	 * @param DeletedUsersIndex $dui
55
-	 * @param UserMapping $mapping
56
-	 */
57
-	public function __construct(User_Proxy $uBackend, LDAPHelper $helper, DeletedUsersIndex $dui, UserMapping $mapping) {
58
-		$this->backend = $uBackend;
59
-		$this->helper = $helper;
60
-		$this->dui = $dui;
61
-		$this->mapping = $mapping;
62
-		parent::__construct();
63
-	}
64
-
65
-	protected function configure() {
66
-		$this
67
-			->setName('ldap:check-user')
68
-			->setDescription('checks whether a user exists on LDAP.')
69
-			->addArgument(
70
-					'ocName',
71
-					InputArgument::REQUIRED,
72
-					'the user name as used in ownCloud'
73
-				     )
74
-			->addOption(
75
-					'force',
76
-					null,
77
-					InputOption::VALUE_NONE,
78
-					'ignores disabled LDAP configuration'
79
-				     )
80
-		;
81
-	}
82
-
83
-	protected function execute(InputInterface $input, OutputInterface $output) {
84
-		try {
85
-			$uid = $input->getArgument('ocName');
86
-			$this->isAllowed($input->getOption('force'));
87
-			$this->confirmUserIsMapped($uid);
88
-			$exists = $this->backend->userExistsOnLDAP($uid);
89
-			if($exists === true) {
90
-				$output->writeln('The user is still available on LDAP.');
91
-				return;
92
-			}
93
-
94
-			$this->dui->markUser($uid);
95
-			$output->writeln('The user does not exists on LDAP anymore.');
96
-			$output->writeln('Clean up the user\'s remnants by: ./occ user:delete "'
97
-				. $uid . '"');
98
-		} catch (\Exception $e) {
99
-			$output->writeln('<error>' . $e->getMessage(). '</error>');
100
-		}
101
-	}
102
-
103
-	/**
104
-	 * checks whether a user is actually mapped
105
-	 * @param string $ocName the username as used in ownCloud
106
-	 * @throws \Exception
107
-	 * @return true
108
-	 */
109
-	protected function confirmUserIsMapped($ocName) {
110
-		$dn = $this->mapping->getDNByName($ocName);
111
-		if ($dn === false) {
112
-			throw new \Exception('The given user is not a recognized LDAP user.');
113
-		}
114
-
115
-		return true;
116
-	}
117
-
118
-	/**
119
-	 * checks whether the setup allows reliable checking of LDAP user existence
120
-	 * @throws \Exception
121
-	 * @return true
122
-	 */
123
-	protected function isAllowed($force) {
124
-		if($this->helper->haveDisabledConfigurations() && !$force) {
125
-			throw new \Exception('Cannot check user existence, because '
126
-				. 'disabled LDAP configurations are present.');
127
-		}
128
-
129
-		// we don't check ldapUserCleanupInterval from config.php because this
130
-		// action is triggered manually, while the setting only controls the
131
-		// background job.
132
-
133
-		return true;
134
-	}
39
+    /** @var \OCA\User_LDAP\User_Proxy */
40
+    protected $backend;
41
+
42
+    /** @var \OCA\User_LDAP\Helper */
43
+    protected $helper;
44
+
45
+    /** @var \OCA\User_LDAP\User\DeletedUsersIndex */
46
+    protected $dui;
47
+
48
+    /** @var \OCA\User_LDAP\Mapping\UserMapping */
49
+    protected $mapping;
50
+
51
+    /**
52
+     * @param User_Proxy $uBackend
53
+     * @param LDAPHelper $helper
54
+     * @param DeletedUsersIndex $dui
55
+     * @param UserMapping $mapping
56
+     */
57
+    public function __construct(User_Proxy $uBackend, LDAPHelper $helper, DeletedUsersIndex $dui, UserMapping $mapping) {
58
+        $this->backend = $uBackend;
59
+        $this->helper = $helper;
60
+        $this->dui = $dui;
61
+        $this->mapping = $mapping;
62
+        parent::__construct();
63
+    }
64
+
65
+    protected function configure() {
66
+        $this
67
+            ->setName('ldap:check-user')
68
+            ->setDescription('checks whether a user exists on LDAP.')
69
+            ->addArgument(
70
+                    'ocName',
71
+                    InputArgument::REQUIRED,
72
+                    'the user name as used in ownCloud'
73
+                        )
74
+            ->addOption(
75
+                    'force',
76
+                    null,
77
+                    InputOption::VALUE_NONE,
78
+                    'ignores disabled LDAP configuration'
79
+                        )
80
+        ;
81
+    }
82
+
83
+    protected function execute(InputInterface $input, OutputInterface $output) {
84
+        try {
85
+            $uid = $input->getArgument('ocName');
86
+            $this->isAllowed($input->getOption('force'));
87
+            $this->confirmUserIsMapped($uid);
88
+            $exists = $this->backend->userExistsOnLDAP($uid);
89
+            if($exists === true) {
90
+                $output->writeln('The user is still available on LDAP.');
91
+                return;
92
+            }
93
+
94
+            $this->dui->markUser($uid);
95
+            $output->writeln('The user does not exists on LDAP anymore.');
96
+            $output->writeln('Clean up the user\'s remnants by: ./occ user:delete "'
97
+                . $uid . '"');
98
+        } catch (\Exception $e) {
99
+            $output->writeln('<error>' . $e->getMessage(). '</error>');
100
+        }
101
+    }
102
+
103
+    /**
104
+     * checks whether a user is actually mapped
105
+     * @param string $ocName the username as used in ownCloud
106
+     * @throws \Exception
107
+     * @return true
108
+     */
109
+    protected function confirmUserIsMapped($ocName) {
110
+        $dn = $this->mapping->getDNByName($ocName);
111
+        if ($dn === false) {
112
+            throw new \Exception('The given user is not a recognized LDAP user.');
113
+        }
114
+
115
+        return true;
116
+    }
117
+
118
+    /**
119
+     * checks whether the setup allows reliable checking of LDAP user existence
120
+     * @throws \Exception
121
+     * @return true
122
+     */
123
+    protected function isAllowed($force) {
124
+        if($this->helper->haveDisabledConfigurations() && !$force) {
125
+            throw new \Exception('Cannot check user existence, because '
126
+                . 'disabled LDAP configurations are present.');
127
+        }
128
+
129
+        // we don't check ldapUserCleanupInterval from config.php because this
130
+        // action is triggered manually, while the setting only controls the
131
+        // background job.
132
+
133
+        return true;
134
+    }
135 135
 
136 136
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Command/Search.php 1 patch
Indentation   +82 added lines, -82 removed lines patch added patch discarded remove patch
@@ -37,93 +37,93 @@
 block discarded – undo
37 37
 use OCP\IConfig;
38 38
 
39 39
 class Search extends Command {
40
-	/** @var \OCP\IConfig */
41
-	protected $ocConfig;
40
+    /** @var \OCP\IConfig */
41
+    protected $ocConfig;
42 42
 
43
-	/**
44
-	 * @param \OCP\IConfig $ocConfig
45
-	 */
46
-	public function __construct(IConfig $ocConfig) {
47
-		$this->ocConfig = $ocConfig;
48
-		parent::__construct();
49
-	}
43
+    /**
44
+     * @param \OCP\IConfig $ocConfig
45
+     */
46
+    public function __construct(IConfig $ocConfig) {
47
+        $this->ocConfig = $ocConfig;
48
+        parent::__construct();
49
+    }
50 50
 
51
-	protected function configure() {
52
-		$this
53
-			->setName('ldap:search')
54
-			->setDescription('executes a user or group search')
55
-			->addArgument(
56
-					'search',
57
-					InputArgument::REQUIRED,
58
-					'the search string (can be empty)'
59
-				     )
60
-			->addOption(
61
-					'group',
62
-					null,
63
-					InputOption::VALUE_NONE,
64
-					'searches groups instead of users'
65
-				     )
66
-			->addOption(
67
-					'offset',
68
-					null,
69
-					InputOption::VALUE_REQUIRED,
70
-					'The offset of the result set. Needs to be a multiple of limit. defaults to 0.',
71
-					0
72
-				     )
73
-			->addOption(
74
-					'limit',
75
-					null,
76
-					InputOption::VALUE_REQUIRED,
77
-					'limit the results. 0 means no limit, defaults to 15',
78
-					15
79
-				     )
80
-		;
81
-	}
51
+    protected function configure() {
52
+        $this
53
+            ->setName('ldap:search')
54
+            ->setDescription('executes a user or group search')
55
+            ->addArgument(
56
+                    'search',
57
+                    InputArgument::REQUIRED,
58
+                    'the search string (can be empty)'
59
+                        )
60
+            ->addOption(
61
+                    'group',
62
+                    null,
63
+                    InputOption::VALUE_NONE,
64
+                    'searches groups instead of users'
65
+                        )
66
+            ->addOption(
67
+                    'offset',
68
+                    null,
69
+                    InputOption::VALUE_REQUIRED,
70
+                    'The offset of the result set. Needs to be a multiple of limit. defaults to 0.',
71
+                    0
72
+                        )
73
+            ->addOption(
74
+                    'limit',
75
+                    null,
76
+                    InputOption::VALUE_REQUIRED,
77
+                    'limit the results. 0 means no limit, defaults to 15',
78
+                    15
79
+                        )
80
+        ;
81
+    }
82 82
 
83
-	/**
84
-	 * Tests whether the offset and limit options are valid
85
-	 * @param int $offset
86
-	 * @param int $limit
87
-	 * @throws \InvalidArgumentException
88
-	 */
89
-	protected function validateOffsetAndLimit($offset, $limit) {
90
-		if($limit < 0) {
91
-			throw new \InvalidArgumentException('limit must be  0 or greater');
92
-		}
93
-		if($offset  < 0) {
94
-			throw new \InvalidArgumentException('offset must be 0 or greater');
95
-		}
96
-		if($limit === 0 && $offset !== 0) {
97
-			throw new \InvalidArgumentException('offset must be 0 if limit is also set to 0');
98
-		}
99
-		if($offset > 0 && ($offset % $limit !== 0)) {
100
-			throw new \InvalidArgumentException('offset must be a multiple of limit');
101
-		}
102
-	}
83
+    /**
84
+     * Tests whether the offset and limit options are valid
85
+     * @param int $offset
86
+     * @param int $limit
87
+     * @throws \InvalidArgumentException
88
+     */
89
+    protected function validateOffsetAndLimit($offset, $limit) {
90
+        if($limit < 0) {
91
+            throw new \InvalidArgumentException('limit must be  0 or greater');
92
+        }
93
+        if($offset  < 0) {
94
+            throw new \InvalidArgumentException('offset must be 0 or greater');
95
+        }
96
+        if($limit === 0 && $offset !== 0) {
97
+            throw new \InvalidArgumentException('offset must be 0 if limit is also set to 0');
98
+        }
99
+        if($offset > 0 && ($offset % $limit !== 0)) {
100
+            throw new \InvalidArgumentException('offset must be a multiple of limit');
101
+        }
102
+    }
103 103
 
104
-	protected function execute(InputInterface $input, OutputInterface $output) {
105
-		$helper = new Helper($this->ocConfig);
106
-		$configPrefixes = $helper->getServerConfigurationPrefixes(true);
107
-		$ldapWrapper = new LDAP();
104
+    protected function execute(InputInterface $input, OutputInterface $output) {
105
+        $helper = new Helper($this->ocConfig);
106
+        $configPrefixes = $helper->getServerConfigurationPrefixes(true);
107
+        $ldapWrapper = new LDAP();
108 108
 
109
-		$offset = intval($input->getOption('offset'));
110
-		$limit = intval($input->getOption('limit'));
111
-		$this->validateOffsetAndLimit($offset, $limit);
109
+        $offset = intval($input->getOption('offset'));
110
+        $limit = intval($input->getOption('limit'));
111
+        $this->validateOffsetAndLimit($offset, $limit);
112 112
 
113
-		if($input->getOption('group')) {
114
-			$proxy = new Group_Proxy($configPrefixes, $ldapWrapper);
115
-			$getMethod = 'getGroups';
116
-			$printID = false;
117
-		} else {
118
-			$proxy = new User_Proxy($configPrefixes, $ldapWrapper, $this->ocConfig);
119
-			$getMethod = 'getDisplayNames';
120
-			$printID = true;
121
-		}
113
+        if($input->getOption('group')) {
114
+            $proxy = new Group_Proxy($configPrefixes, $ldapWrapper);
115
+            $getMethod = 'getGroups';
116
+            $printID = false;
117
+        } else {
118
+            $proxy = new User_Proxy($configPrefixes, $ldapWrapper, $this->ocConfig);
119
+            $getMethod = 'getDisplayNames';
120
+            $printID = true;
121
+        }
122 122
 
123
-		$result = $proxy->$getMethod($input->getArgument('search'), $limit, $offset);
124
-		foreach($result as $id => $name) {
125
-			$line = $name . ($printID ? ' ('.$id.')' : '');
126
-			$output->writeln($line);
127
-		}
128
-	}
123
+        $result = $proxy->$getMethod($input->getArgument('search'), $limit, $offset);
124
+        foreach($result as $id => $name) {
125
+            $line = $name . ($printID ? ' ('.$id.')' : '');
126
+            $output->writeln($line);
127
+        }
128
+    }
129 129
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Command/DeleteConfig.php 1 patch
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -33,39 +33,39 @@
 block discarded – undo
33 33
 use Symfony\Component\Console\Output\OutputInterface;
34 34
 
35 35
 class DeleteConfig extends Command {
36
-	/** @var \OCA\User_LDAP\Helper */
37
-	protected $helper;
36
+    /** @var \OCA\User_LDAP\Helper */
37
+    protected $helper;
38 38
 
39
-	/**
40
-	 * @param Helper $helper
41
-	 */
42
-	public function __construct(Helper $helper) {
43
-		$this->helper = $helper;
44
-		parent::__construct();
45
-	}
39
+    /**
40
+     * @param Helper $helper
41
+     */
42
+    public function __construct(Helper $helper) {
43
+        $this->helper = $helper;
44
+        parent::__construct();
45
+    }
46 46
 
47
-	protected function configure() {
48
-		$this
49
-			->setName('ldap:delete-config')
50
-			->setDescription('deletes an existing LDAP configuration')
51
-			->addArgument(
52
-					'configID',
53
-					InputArgument::REQUIRED,
54
-					'the configuration ID'
55
-				     )
56
-		;
57
-	}
47
+    protected function configure() {
48
+        $this
49
+            ->setName('ldap:delete-config')
50
+            ->setDescription('deletes an existing LDAP configuration')
51
+            ->addArgument(
52
+                    'configID',
53
+                    InputArgument::REQUIRED,
54
+                    'the configuration ID'
55
+                        )
56
+        ;
57
+    }
58 58
 
59 59
 
60
-	protected function execute(InputInterface $input, OutputInterface $output) {
61
-		$configPrefix = $input->getArgument('configID');
60
+    protected function execute(InputInterface $input, OutputInterface $output) {
61
+        $configPrefix = $input->getArgument('configID');
62 62
 
63
-		$success = $this->helper->deleteServerConfiguration($configPrefix);
63
+        $success = $this->helper->deleteServerConfiguration($configPrefix);
64 64
 
65
-		if($success) {
66
-			$output->writeln("Deleted configuration with configID '{$configPrefix}'");
67
-		} else {
68
-			$output->writeln("Cannot delete configuration with configID '{$configPrefix}'");
69
-		}
70
-	}
65
+        if($success) {
66
+            $output->writeln("Deleted configuration with configID '{$configPrefix}'");
67
+        } else {
68
+            $output->writeln("Cannot delete configuration with configID '{$configPrefix}'");
69
+        }
70
+    }
71 71
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Command/TestConfig.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -34,59 +34,59 @@
 block discarded – undo
34 34
 
35 35
 class TestConfig extends Command {
36 36
 
37
-	protected function configure() {
38
-		$this
39
-			->setName('ldap:test-config')
40
-			->setDescription('tests an LDAP configuration')
41
-			->addArgument(
42
-					'configID',
43
-					InputArgument::REQUIRED,
44
-					'the configuration ID'
45
-				     )
46
-		;
47
-	}
37
+    protected function configure() {
38
+        $this
39
+            ->setName('ldap:test-config')
40
+            ->setDescription('tests an LDAP configuration')
41
+            ->addArgument(
42
+                    'configID',
43
+                    InputArgument::REQUIRED,
44
+                    'the configuration ID'
45
+                        )
46
+        ;
47
+    }
48 48
 
49
-	protected function execute(InputInterface $input, OutputInterface $output) {
50
-		$helper = new Helper(\OC::$server->getConfig());
51
-		$availableConfigs = $helper->getServerConfigurationPrefixes();
52
-		$configID = $input->getArgument('configID');
53
-		if(!in_array($configID, $availableConfigs)) {
54
-			$output->writeln("Invalid configID");
55
-			return;
56
-		}
49
+    protected function execute(InputInterface $input, OutputInterface $output) {
50
+        $helper = new Helper(\OC::$server->getConfig());
51
+        $availableConfigs = $helper->getServerConfigurationPrefixes();
52
+        $configID = $input->getArgument('configID');
53
+        if(!in_array($configID, $availableConfigs)) {
54
+            $output->writeln("Invalid configID");
55
+            return;
56
+        }
57 57
 
58
-		$result = $this->testConfig($configID);
59
-		if($result === 0) {
60
-			$output->writeln('The configuration is valid and the connection could be established!');
61
-		} else if($result === 1) {
62
-			$output->writeln('The configuration is invalid. Please have a look at the logs for further details.');
63
-		} else if($result === 2) {
64
-			$output->writeln('The configuration is valid, but the Bind failed. Please check the server settings and credentials.');
65
-		} else {
66
-			$output->writeln('Your LDAP server was kidnapped by aliens.');
67
-		}
68
-	}
58
+        $result = $this->testConfig($configID);
59
+        if($result === 0) {
60
+            $output->writeln('The configuration is valid and the connection could be established!');
61
+        } else if($result === 1) {
62
+            $output->writeln('The configuration is invalid. Please have a look at the logs for further details.');
63
+        } else if($result === 2) {
64
+            $output->writeln('The configuration is valid, but the Bind failed. Please check the server settings and credentials.');
65
+        } else {
66
+            $output->writeln('Your LDAP server was kidnapped by aliens.');
67
+        }
68
+    }
69 69
 
70
-	/**
71
-	 * tests the specified connection
72
-	 * @param string $configID
73
-	 * @return int
74
-	 */
75
-	protected function testConfig($configID) {
76
-		$lw = new \OCA\User_LDAP\LDAP();
77
-		$connection = new Connection($lw, $configID);
70
+    /**
71
+     * tests the specified connection
72
+     * @param string $configID
73
+     * @return int
74
+     */
75
+    protected function testConfig($configID) {
76
+        $lw = new \OCA\User_LDAP\LDAP();
77
+        $connection = new Connection($lw, $configID);
78 78
 
79
-		//ensure validation is run before we attempt the bind
80
-		$connection->getConfiguration();
79
+        //ensure validation is run before we attempt the bind
80
+        $connection->getConfiguration();
81 81
 
82
-		if(!$connection->setConfiguration(array(
83
-			'ldap_configuration_active' => 1,
84
-		))) {
85
-			return 1;
86
-		}
87
-		if($connection->bind()) {
88
-			return 0;
89
-		}
90
-		return 2;
91
-	}
82
+        if(!$connection->setConfiguration(array(
83
+            'ldap_configuration_active' => 1,
84
+        ))) {
85
+            return 1;
86
+        }
87
+        if($connection->bind()) {
88
+            return 0;
89
+        }
90
+        return 2;
91
+    }
92 92
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Command/SetConfig.php 1 patch
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -34,53 +34,53 @@
 block discarded – undo
34 34
 
35 35
 class SetConfig extends Command {
36 36
 
37
-	protected function configure() {
38
-		$this
39
-			->setName('ldap:set-config')
40
-			->setDescription('modifies an LDAP configuration')
41
-			->addArgument(
42
-					'configID',
43
-					InputArgument::REQUIRED,
44
-					'the configuration ID'
45
-				     )
46
-			->addArgument(
47
-					'configKey',
48
-					InputArgument::REQUIRED,
49
-					'the configuration key'
50
-				     )
51
-			->addArgument(
52
-					'configValue',
53
-					InputArgument::REQUIRED,
54
-					'the new configuration value'
55
-				     )
56
-		;
57
-	}
37
+    protected function configure() {
38
+        $this
39
+            ->setName('ldap:set-config')
40
+            ->setDescription('modifies an LDAP configuration')
41
+            ->addArgument(
42
+                    'configID',
43
+                    InputArgument::REQUIRED,
44
+                    'the configuration ID'
45
+                        )
46
+            ->addArgument(
47
+                    'configKey',
48
+                    InputArgument::REQUIRED,
49
+                    'the configuration key'
50
+                        )
51
+            ->addArgument(
52
+                    'configValue',
53
+                    InputArgument::REQUIRED,
54
+                    'the new configuration value'
55
+                        )
56
+        ;
57
+    }
58 58
 
59
-	protected function execute(InputInterface $input, OutputInterface $output) {
60
-		$helper = new Helper(\OC::$server->getConfig());
61
-		$availableConfigs = $helper->getServerConfigurationPrefixes();
62
-		$configID = $input->getArgument('configID');
63
-		if(!in_array($configID, $availableConfigs)) {
64
-			$output->writeln("Invalid configID");
65
-			return;
66
-		}
59
+    protected function execute(InputInterface $input, OutputInterface $output) {
60
+        $helper = new Helper(\OC::$server->getConfig());
61
+        $availableConfigs = $helper->getServerConfigurationPrefixes();
62
+        $configID = $input->getArgument('configID');
63
+        if(!in_array($configID, $availableConfigs)) {
64
+            $output->writeln("Invalid configID");
65
+            return;
66
+        }
67 67
 
68
-		$this->setValue(
69
-			$configID,
70
-			$input->getArgument('configKey'),
71
-			$input->getArgument('configValue')
72
-		);
73
-	}
68
+        $this->setValue(
69
+            $configID,
70
+            $input->getArgument('configKey'),
71
+            $input->getArgument('configValue')
72
+        );
73
+    }
74 74
 
75
-	/**
76
-	 * save the configuration value as provided
77
-	 * @param string $configID
78
-	 * @param string $configKey
79
-	 * @param string $configValue
80
-	 */
81
-	protected function setValue($configID, $key, $value) {
82
-		$configHolder = new Configuration($configID);
83
-		$configHolder->$key = $value;
84
-		$configHolder->saveConfiguration();
85
-	}
75
+    /**
76
+     * save the configuration value as provided
77
+     * @param string $configID
78
+     * @param string $configKey
79
+     * @param string $configValue
80
+     */
81
+    protected function setValue($configID, $key, $value) {
82
+        $configHolder = new Configuration($configID);
83
+        $configHolder->$key = $value;
84
+        $configHolder->saveConfiguration();
85
+    }
86 86
 }
Please login to merge, or discard this patch.