Completed
Push — master ( eba447...1a7516 )
by Blizzz
18:31
created
apps/files_versions/composer/composer/autoload_psr4.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,5 +6,5 @@
 block discarded – undo
6 6
 $baseDir = $vendorDir;
7 7
 
8 8
 return array(
9
-    'OCA\\Files_Versions\\' => array($baseDir . '/../lib'),
9
+    'OCA\\Files_Versions\\' => array($baseDir.'/../lib'),
10 10
 );
Please login to merge, or discard this patch.
lib/private/Repair/NC13/AddLogRotateJob.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@
 block discarded – undo
29 29
 
30 30
 class AddLogRotateJob implements IRepairStep {
31 31
 
32
-	/** @var IJobList */
33
-	private $jobList;
32
+    /** @var IJobList */
33
+    private $jobList;
34 34
 
35
-	public function __construct(IJobList $jobList) {
36
-		$this->jobList = $jobList;
37
-	}
35
+    public function __construct(IJobList $jobList) {
36
+        $this->jobList = $jobList;
37
+    }
38 38
 
39
-	public function getName() {
40
-		return 'Add log rotate job';
41
-	}
39
+    public function getName() {
40
+        return 'Add log rotate job';
41
+    }
42 42
 
43
-	public function run(IOutput $output) {
44
-		$this->jobList->add(Rotate::class);
45
-	}
43
+    public function run(IOutput $output) {
44
+        $this->jobList->add(Rotate::class);
45
+    }
46 46
 
47 47
 }
Please login to merge, or discard this patch.
apps/files_versions/lib/Hooks.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
 	/**
54 54
 	 * listen to write event.
55 55
 	 */
56
-	public static function write_hook( $params ) {
56
+	public static function write_hook($params) {
57 57
 		$path = $params[\OC\Files\Filesystem::signal_param_path];
58
-		if($path !== '') {
58
+		if ($path !== '') {
59 59
 			Storage::store($path);
60 60
 		}
61 61
 	}
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public static function remove_hook($params) {
72 72
 		$path = $params[\OC\Files\Filesystem::signal_param_path];
73
-		if($path !== '') {
73
+		if ($path !== '') {
74 74
 			Storage::delete($path);
75 75
 		}
76 76
 	}
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public static function pre_remove_hook($params) {
83 83
 		$path = $params[\OC\Files\Filesystem::signal_param_path];
84
-			if($path !== '') {
84
+			if ($path !== '') {
85 85
 				Storage::markDeletedFile($path);
86 86
 			}
87 87
 	}
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 	public static function rename_hook($params) {
97 97
 		$oldpath = $params['oldpath'];
98 98
 		$newpath = $params['newpath'];
99
-		if($oldpath !== '' && $newpath !== '') {
99
+		if ($oldpath !== '' && $newpath !== '') {
100 100
 			Storage::renameOrCopy($oldpath, $newpath, 'rename');
101 101
 		}
102 102
 	}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	public static function copy_hook($params) {
112 112
 		$oldpath = $params['oldpath'];
113 113
 		$newpath = $params['newpath'];
114
-		if($oldpath !== '' && $newpath !== '') {
114
+		if ($oldpath !== '' && $newpath !== '') {
115 115
 			Storage::renameOrCopy($oldpath, $newpath, 'copy');
116 116
 		}
117 117
 	}
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	public static function pre_renameOrCopy_hook($params) {
128 128
 		// if we rename a movable mount point, then the versions don't have
129 129
 		// to be renamed
130
-		$absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files' . $params['oldpath']);
130
+		$absOldPath = \OC\Files\Filesystem::normalizePath('/'.\OCP\User::getUser().'/files'.$params['oldpath']);
131 131
 		$manager = \OC\Files\Filesystem::getMountManager();
132 132
 		$mount = $manager->find($absOldPath);
133 133
 		$internalPath = $mount->getInternalPath($absOldPath);
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 			return;
136 136
 		}
137 137
 
138
-		$view = new \OC\Files\View(\OCP\User::getUser() . '/files');
138
+		$view = new \OC\Files\View(\OCP\User::getUser().'/files');
139 139
 		if ($view->file_exists($params['newpath'])) {
140 140
 			Storage::store($params['newpath']);
141 141
 		} else {
Please login to merge, or discard this patch.
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -37,118 +37,118 @@
 block discarded – undo
37 37
 
38 38
 class Hooks {
39 39
 
40
-	public static function connectHooks() {
41
-		// Listen to write signals
42
-		\OCP\Util::connectHook('OC_Filesystem', 'write', Hooks::class, 'write_hook');
43
-		// Listen to delete and rename signals
44
-		\OCP\Util::connectHook('OC_Filesystem', 'post_delete', Hooks::class, 'remove_hook');
45
-		\OCP\Util::connectHook('OC_Filesystem', 'delete', Hooks::class, 'pre_remove_hook');
46
-		\OCP\Util::connectHook('OC_Filesystem', 'post_rename', Hooks::class, 'rename_hook');
47
-		\OCP\Util::connectHook('OC_Filesystem', 'post_copy', Hooks::class, 'copy_hook');
48
-		\OCP\Util::connectHook('OC_Filesystem', 'rename', Hooks::class, 'pre_renameOrCopy_hook');
49
-		\OCP\Util::connectHook('OC_Filesystem', 'copy', Hooks::class, 'pre_renameOrCopy_hook');
40
+    public static function connectHooks() {
41
+        // Listen to write signals
42
+        \OCP\Util::connectHook('OC_Filesystem', 'write', Hooks::class, 'write_hook');
43
+        // Listen to delete and rename signals
44
+        \OCP\Util::connectHook('OC_Filesystem', 'post_delete', Hooks::class, 'remove_hook');
45
+        \OCP\Util::connectHook('OC_Filesystem', 'delete', Hooks::class, 'pre_remove_hook');
46
+        \OCP\Util::connectHook('OC_Filesystem', 'post_rename', Hooks::class, 'rename_hook');
47
+        \OCP\Util::connectHook('OC_Filesystem', 'post_copy', Hooks::class, 'copy_hook');
48
+        \OCP\Util::connectHook('OC_Filesystem', 'rename', Hooks::class, 'pre_renameOrCopy_hook');
49
+        \OCP\Util::connectHook('OC_Filesystem', 'copy', Hooks::class, 'pre_renameOrCopy_hook');
50 50
 
51
-		$eventDispatcher = \OC::$server->getEventDispatcher();
52
-		$eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', [Hooks::class, 'onLoadFilesAppScripts']);
53
-	}
51
+        $eventDispatcher = \OC::$server->getEventDispatcher();
52
+        $eventDispatcher->addListener('OCA\Files::loadAdditionalScripts', [Hooks::class, 'onLoadFilesAppScripts']);
53
+    }
54 54
 
55
-	/**
56
-	 * listen to write event.
57
-	 */
58
-	public static function write_hook( $params ) {
59
-		$path = $params[\OC\Files\Filesystem::signal_param_path];
60
-		if($path !== '') {
61
-			Storage::store($path);
62
-		}
63
-	}
55
+    /**
56
+     * listen to write event.
57
+     */
58
+    public static function write_hook( $params ) {
59
+        $path = $params[\OC\Files\Filesystem::signal_param_path];
60
+        if($path !== '') {
61
+            Storage::store($path);
62
+        }
63
+    }
64 64
 
65 65
 
66
-	/**
67
-	 * Erase versions of deleted file
68
-	 * @param array $params
69
-	 *
70
-	 * This function is connected to the delete signal of OC_Filesystem
71
-	 * cleanup the versions directory if the actual file gets deleted
72
-	 */
73
-	public static function remove_hook($params) {
74
-		$path = $params[\OC\Files\Filesystem::signal_param_path];
75
-		if($path !== '') {
76
-			Storage::delete($path);
77
-		}
78
-	}
66
+    /**
67
+     * Erase versions of deleted file
68
+     * @param array $params
69
+     *
70
+     * This function is connected to the delete signal of OC_Filesystem
71
+     * cleanup the versions directory if the actual file gets deleted
72
+     */
73
+    public static function remove_hook($params) {
74
+        $path = $params[\OC\Files\Filesystem::signal_param_path];
75
+        if($path !== '') {
76
+            Storage::delete($path);
77
+        }
78
+    }
79 79
 
80
-	/**
81
-	 * mark file as "deleted" so that we can clean up the versions if the file is gone
82
-	 * @param array $params
83
-	 */
84
-	public static function pre_remove_hook($params) {
85
-		$path = $params[\OC\Files\Filesystem::signal_param_path];
86
-			if($path !== '') {
87
-				Storage::markDeletedFile($path);
88
-			}
89
-	}
80
+    /**
81
+     * mark file as "deleted" so that we can clean up the versions if the file is gone
82
+     * @param array $params
83
+     */
84
+    public static function pre_remove_hook($params) {
85
+        $path = $params[\OC\Files\Filesystem::signal_param_path];
86
+            if($path !== '') {
87
+                Storage::markDeletedFile($path);
88
+            }
89
+    }
90 90
 
91
-	/**
92
-	 * rename/move versions of renamed/moved files
93
-	 * @param array $params array with oldpath and newpath
94
-	 *
95
-	 * This function is connected to the rename signal of OC_Filesystem and adjust the name and location
96
-	 * of the stored versions along the actual file
97
-	 */
98
-	public static function rename_hook($params) {
99
-		$oldpath = $params['oldpath'];
100
-		$newpath = $params['newpath'];
101
-		if($oldpath !== '' && $newpath !== '') {
102
-			Storage::renameOrCopy($oldpath, $newpath, 'rename');
103
-		}
104
-	}
91
+    /**
92
+     * rename/move versions of renamed/moved files
93
+     * @param array $params array with oldpath and newpath
94
+     *
95
+     * This function is connected to the rename signal of OC_Filesystem and adjust the name and location
96
+     * of the stored versions along the actual file
97
+     */
98
+    public static function rename_hook($params) {
99
+        $oldpath = $params['oldpath'];
100
+        $newpath = $params['newpath'];
101
+        if($oldpath !== '' && $newpath !== '') {
102
+            Storage::renameOrCopy($oldpath, $newpath, 'rename');
103
+        }
104
+    }
105 105
 
106
-	/**
107
-	 * copy versions of copied files
108
-	 * @param array $params array with oldpath and newpath
109
-	 *
110
-	 * This function is connected to the copy signal of OC_Filesystem and copies the
111
-	 * the stored versions to the new location
112
-	 */
113
-	public static function copy_hook($params) {
114
-		$oldpath = $params['oldpath'];
115
-		$newpath = $params['newpath'];
116
-		if($oldpath !== '' && $newpath !== '') {
117
-			Storage::renameOrCopy($oldpath, $newpath, 'copy');
118
-		}
119
-	}
106
+    /**
107
+     * copy versions of copied files
108
+     * @param array $params array with oldpath and newpath
109
+     *
110
+     * This function is connected to the copy signal of OC_Filesystem and copies the
111
+     * the stored versions to the new location
112
+     */
113
+    public static function copy_hook($params) {
114
+        $oldpath = $params['oldpath'];
115
+        $newpath = $params['newpath'];
116
+        if($oldpath !== '' && $newpath !== '') {
117
+            Storage::renameOrCopy($oldpath, $newpath, 'copy');
118
+        }
119
+    }
120 120
 
121
-	/**
122
-	 * Remember owner and the owner path of the source file.
123
-	 * If the file already exists, then it was a upload of a existing file
124
-	 * over the web interface and we call Storage::store() directly
125
-	 *
126
-	 * @param array $params array with oldpath and newpath
127
-	 *
128
-	 */
129
-	public static function pre_renameOrCopy_hook($params) {
130
-		// if we rename a movable mount point, then the versions don't have
131
-		// to be renamed
132
-		$absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files' . $params['oldpath']);
133
-		$manager = \OC\Files\Filesystem::getMountManager();
134
-		$mount = $manager->find($absOldPath);
135
-		$internalPath = $mount->getInternalPath($absOldPath);
136
-		if ($internalPath === '' and $mount instanceof \OC\Files\Mount\MoveableMount) {
137
-			return;
138
-		}
121
+    /**
122
+     * Remember owner and the owner path of the source file.
123
+     * If the file already exists, then it was a upload of a existing file
124
+     * over the web interface and we call Storage::store() directly
125
+     *
126
+     * @param array $params array with oldpath and newpath
127
+     *
128
+     */
129
+    public static function pre_renameOrCopy_hook($params) {
130
+        // if we rename a movable mount point, then the versions don't have
131
+        // to be renamed
132
+        $absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files' . $params['oldpath']);
133
+        $manager = \OC\Files\Filesystem::getMountManager();
134
+        $mount = $manager->find($absOldPath);
135
+        $internalPath = $mount->getInternalPath($absOldPath);
136
+        if ($internalPath === '' and $mount instanceof \OC\Files\Mount\MoveableMount) {
137
+            return;
138
+        }
139 139
 
140
-		$view = new \OC\Files\View(\OCP\User::getUser() . '/files');
141
-		if ($view->file_exists($params['newpath'])) {
142
-			Storage::store($params['newpath']);
143
-		} else {
144
-			Storage::setSourcePathAndUser($params['oldpath']);
145
-		}
146
-	}
140
+        $view = new \OC\Files\View(\OCP\User::getUser() . '/files');
141
+        if ($view->file_exists($params['newpath'])) {
142
+            Storage::store($params['newpath']);
143
+        } else {
144
+            Storage::setSourcePathAndUser($params['oldpath']);
145
+        }
146
+    }
147 147
 
148
-	/**
149
-	 * Load additional scripts when the files app is visible
150
-	 */
151
-	public static function onLoadFilesAppScripts() {
152
-		\OCP\Util::addScript('files_versions', 'merged');
153
-	}
148
+    /**
149
+     * Load additional scripts when the files app is visible
150
+     */
151
+    public static function onLoadFilesAppScripts() {
152
+        \OCP\Util::addScript('files_versions', 'merged');
153
+    }
154 154
 }
Please login to merge, or discard this patch.
apps/files_trashbin/lib/Hooks.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -31,22 +31,22 @@
 block discarded – undo
31 31
 
32 32
 class Hooks {
33 33
 
34
-	/**
35
-	 * clean up user specific settings if user gets deleted
36
-	 * @param array $params array with uid
37
-	 *
38
-	 * This function is connected to the pre_deleteUser signal of OC_Users
39
-	 * to remove the used space for the trash bin stored in the database
40
-	 */
41
-	public static function deleteUser_hook($params) {
42
-		$uid = $params['uid'];
43
-		Trashbin::deleteUser($uid);
44
-	}
34
+    /**
35
+     * clean up user specific settings if user gets deleted
36
+     * @param array $params array with uid
37
+     *
38
+     * This function is connected to the pre_deleteUser signal of OC_Users
39
+     * to remove the used space for the trash bin stored in the database
40
+     */
41
+    public static function deleteUser_hook($params) {
42
+        $uid = $params['uid'];
43
+        Trashbin::deleteUser($uid);
44
+    }
45 45
 
46
-	public static function post_write_hook($params) {
47
-		$user = \OCP\User::getUser();
48
-		if (!empty($user)) {
49
-			Trashbin::resizeTrash($user);
50
-		}
51
-	}
46
+    public static function post_write_hook($params) {
47
+        $user = \OCP\User::getUser();
48
+        if (!empty($user)) {
49
+            Trashbin::resizeTrash($user);
50
+        }
51
+    }
52 52
 }
Please login to merge, or discard this patch.
lib/private/Collaboration/Collaborators/SearchResult.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 
38 38
 	public function addResultSet(SearchResultType $type, array $matches, array $exactMatches = null) {
39 39
 		$type = $type->getLabel();
40
-		if(!isset($this->result[$type])) {
40
+		if (!isset($this->result[$type])) {
41 41
 			$this->result[$type] = [];
42 42
 			$this->result['exact'][$type] = [];
43 43
 		}
44 44
 
45 45
 		$this->result[$type] = array_merge($this->result[$type], $matches);
46
-		if(is_array($exactMatches)) {
46
+		if (is_array($exactMatches)) {
47 47
 			$this->result['exact'][$type] = array_merge($this->result['exact'][$type], $exactMatches);
48 48
 		}
49 49
 	}
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
 
59 59
 	public function hasResult(SearchResultType $type, $collaboratorId) {
60 60
 		$type = $type->getLabel();
61
-		if(!isset($this->result[$type])) {
61
+		if (!isset($this->result[$type])) {
62 62
 			return false;
63 63
 		}
64 64
 
65 65
 		$resultArrays = [$this->result['exact'][$type], $this->result[$type]];
66
-		foreach($resultArrays as $resultArray) {
66
+		foreach ($resultArrays as $resultArray) {
67 67
 			foreach ($resultArray as $result) {
68 68
 				if ($result['value']['shareWith'] === $collaboratorId) {
69 69
 					return true;
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	public function unsetResult(SearchResultType $type) {
82 82
 		$type = $type->getLabel();
83 83
 		$this->result[$type] = [];
84
-		if(isset($this->result['exact'][$type])) {
84
+		if (isset($this->result['exact'][$type])) {
85 85
 			$this->result['exact'][$type] = [];
86 86
 		}
87 87
 	}
Please login to merge, or discard this patch.
Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -29,60 +29,60 @@
 block discarded – undo
29 29
 
30 30
 class SearchResult implements ISearchResult {
31 31
 
32
-	protected $result = [
33
-		'exact' => [],
34
-	];
32
+    protected $result = [
33
+        'exact' => [],
34
+    ];
35 35
 
36
-	protected $exactIdMatches = [];
36
+    protected $exactIdMatches = [];
37 37
 
38
-	public function addResultSet(SearchResultType $type, array $matches, array $exactMatches = null) {
39
-		$type = $type->getLabel();
40
-		if(!isset($this->result[$type])) {
41
-			$this->result[$type] = [];
42
-			$this->result['exact'][$type] = [];
43
-		}
38
+    public function addResultSet(SearchResultType $type, array $matches, array $exactMatches = null) {
39
+        $type = $type->getLabel();
40
+        if(!isset($this->result[$type])) {
41
+            $this->result[$type] = [];
42
+            $this->result['exact'][$type] = [];
43
+        }
44 44
 
45
-		$this->result[$type] = array_merge($this->result[$type], $matches);
46
-		if(is_array($exactMatches)) {
47
-			$this->result['exact'][$type] = array_merge($this->result['exact'][$type], $exactMatches);
48
-		}
49
-	}
45
+        $this->result[$type] = array_merge($this->result[$type], $matches);
46
+        if(is_array($exactMatches)) {
47
+            $this->result['exact'][$type] = array_merge($this->result['exact'][$type], $exactMatches);
48
+        }
49
+    }
50 50
 
51
-	public function markExactIdMatch(SearchResultType $type) {
52
-		$this->exactIdMatches[$type->getLabel()] = 1;
53
-	}
51
+    public function markExactIdMatch(SearchResultType $type) {
52
+        $this->exactIdMatches[$type->getLabel()] = 1;
53
+    }
54 54
 
55
-	public function hasExactIdMatch(SearchResultType $type) {
56
-		return isset($this->exactIdMatches[$type->getLabel()]);
57
-	}
55
+    public function hasExactIdMatch(SearchResultType $type) {
56
+        return isset($this->exactIdMatches[$type->getLabel()]);
57
+    }
58 58
 
59
-	public function hasResult(SearchResultType $type, $collaboratorId) {
60
-		$type = $type->getLabel();
61
-		if(!isset($this->result[$type])) {
62
-			return false;
63
-		}
59
+    public function hasResult(SearchResultType $type, $collaboratorId) {
60
+        $type = $type->getLabel();
61
+        if(!isset($this->result[$type])) {
62
+            return false;
63
+        }
64 64
 
65
-		$resultArrays = [$this->result['exact'][$type], $this->result[$type]];
66
-		foreach($resultArrays as $resultArray) {
67
-			foreach ($resultArray as $result) {
68
-				if ($result['value']['shareWith'] === $collaboratorId) {
69
-					return true;
70
-				}
71
-			}
72
-		}
65
+        $resultArrays = [$this->result['exact'][$type], $this->result[$type]];
66
+        foreach($resultArrays as $resultArray) {
67
+            foreach ($resultArray as $result) {
68
+                if ($result['value']['shareWith'] === $collaboratorId) {
69
+                    return true;
70
+                }
71
+            }
72
+        }
73 73
 
74
-		return false;
75
-	}
74
+        return false;
75
+    }
76 76
 
77
-	public function asArray() {
78
-		return $this->result;
79
-	}
77
+    public function asArray() {
78
+        return $this->result;
79
+    }
80 80
 
81
-	public function unsetResult(SearchResultType $type) {
82
-		$type = $type->getLabel();
83
-		$this->result[$type] = [];
84
-		if(isset($this->result['exact'][$type])) {
85
-			$this->result['exact'][$type] = [];
86
-		}
87
-	}
81
+    public function unsetResult(SearchResultType $type) {
82
+        $type = $type->getLabel();
83
+        $this->result[$type] = [];
84
+        if(isset($this->result['exact'][$type])) {
85
+            $this->result['exact'][$type] = [];
86
+        }
87
+    }
88 88
 }
Please login to merge, or discard this patch.
apps/user_ldap/appinfo/register_command.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,15 +34,15 @@  discard block
 block discarded – undo
34 34
 $helper = new Helper(\OC::$server->getConfig());
35 35
 $ocConfig = \OC::$server->getConfig();
36 36
 $uBackend = new User_Proxy(
37
-	$helper->getServerConfigurationPrefixes(true),
38
-	new LDAP(),
39
-	$ocConfig,
40
-	\OC::$server->getNotificationManager(),
41
-	\OC::$server->getUserSession(),
42
-	\OC::$server->query('LDAPUserPluginManager')
37
+    $helper->getServerConfigurationPrefixes(true),
38
+    new LDAP(),
39
+    $ocConfig,
40
+    \OC::$server->getNotificationManager(),
41
+    \OC::$server->getUserSession(),
42
+    \OC::$server->query('LDAPUserPluginManager')
43 43
 );
44 44
 $deletedUsersIndex = new DeletedUsersIndex(
45
-	$ocConfig, $dbConnection, $userMapping
45
+    $ocConfig, $dbConnection, $userMapping
46 46
 );
47 47
 
48 48
 $application->add(new OCA\User_LDAP\Command\ShowConfig($helper));
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 $application->add(new OCA\User_LDAP\Command\DeleteConfig($helper));
53 53
 $application->add(new OCA\User_LDAP\Command\Search($ocConfig));
54 54
 $application->add(new OCA\User_LDAP\Command\ShowRemnants(
55
-	$deletedUsersIndex, \OC::$server->getDateTimeFormatter())
55
+    $deletedUsersIndex, \OC::$server->getDateTimeFormatter())
56 56
 );
57 57
 $application->add(new OCA\User_LDAP\Command\CheckUser(
58
-	$uBackend, $helper, $deletedUsersIndex, $userMapping)
58
+    $uBackend, $helper, $deletedUsersIndex, $userMapping)
59 59
 );
Please login to merge, or discard this patch.
apps/user_ldap/appinfo/app.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -30,50 +30,50 @@
 block discarded – undo
30 30
  */
31 31
 
32 32
 \OC::$server->registerService('LDAPUserPluginManager', function() {
33
-	return new OCA\User_LDAP\UserPluginManager();
33
+    return new OCA\User_LDAP\UserPluginManager();
34 34
 });
35 35
 \OC::$server->registerService('LDAPGroupPluginManager', function() {
36
-	return new OCA\User_LDAP\GroupPluginManager();
36
+    return new OCA\User_LDAP\GroupPluginManager();
37 37
 });
38 38
 
39 39
 $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
40 40
 $configPrefixes = $helper->getServerConfigurationPrefixes(true);
41 41
 if(count($configPrefixes) > 0) {
42
-	$ldapWrapper = new OCA\User_LDAP\LDAP();
43
-	$ocConfig = \OC::$server->getConfig();
44
-	$notificationManager = \OC::$server->getNotificationManager();
45
-	$notificationManager->registerNotifier(function() {
46
-		return new \OCA\User_LDAP\Notification\Notifier(
47
-			\OC::$server->getL10NFactory()
48
-		);
49
-	}, function() {
50
-		$l = \OC::$server->getL10N('user_ldap');
51
-		return [
52
-			'id' => 'user_ldap',
53
-			'name' => $l->t('LDAP user and group backend'),
54
-		];
55
-	});
56
-	$userSession = \OC::$server->getUserSession();
42
+    $ldapWrapper = new OCA\User_LDAP\LDAP();
43
+    $ocConfig = \OC::$server->getConfig();
44
+    $notificationManager = \OC::$server->getNotificationManager();
45
+    $notificationManager->registerNotifier(function() {
46
+        return new \OCA\User_LDAP\Notification\Notifier(
47
+            \OC::$server->getL10NFactory()
48
+        );
49
+    }, function() {
50
+        $l = \OC::$server->getL10N('user_ldap');
51
+        return [
52
+            'id' => 'user_ldap',
53
+            'name' => $l->t('LDAP user and group backend'),
54
+        ];
55
+    });
56
+    $userSession = \OC::$server->getUserSession();
57 57
 
58
-	$userPluginManager = \OC::$server->query('LDAPUserPluginManager');
59
-	$groupPluginManager = \OC::$server->query('LDAPGroupPluginManager');
58
+    $userPluginManager = \OC::$server->query('LDAPUserPluginManager');
59
+    $groupPluginManager = \OC::$server->query('LDAPGroupPluginManager');
60 60
 
61
-	$userBackend  = new OCA\User_LDAP\User_Proxy(
62
-		$configPrefixes, $ldapWrapper, $ocConfig, $notificationManager, $userSession, $userPluginManager
63
-	);
64
-	$groupBackend  = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper, $groupPluginManager);
65
-	// register user backend
66
-	OC_User::useBackend($userBackend);
61
+    $userBackend  = new OCA\User_LDAP\User_Proxy(
62
+        $configPrefixes, $ldapWrapper, $ocConfig, $notificationManager, $userSession, $userPluginManager
63
+    );
64
+    $groupBackend  = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper, $groupPluginManager);
65
+    // register user backend
66
+    OC_User::useBackend($userBackend);
67 67
 
68
-	// Hook to allow plugins to work on registered backends
69
-	OC::$server->getEventDispatcher()->dispatch('OCA\\User_LDAP\\User\\User::postLDAPBackendAdded');
68
+    // Hook to allow plugins to work on registered backends
69
+    OC::$server->getEventDispatcher()->dispatch('OCA\\User_LDAP\\User\\User::postLDAPBackendAdded');
70 70
 
71
-	\OC::$server->getGroupManager()->addBackend($groupBackend);
71
+    \OC::$server->getGroupManager()->addBackend($groupBackend);
72 72
 }
73 73
 
74 74
 \OCP\Util::connectHook(
75
-	'\OCA\Files_Sharing\API\Server2Server',
76
-	'preLoginNameUsedAsUserName',
77
-	'\OCA\User_LDAP\Helper',
78
-	'loginName2UserName'
75
+    '\OCA\Files_Sharing\API\Server2Server',
76
+    'preLoginNameUsedAsUserName',
77
+    '\OCA\User_LDAP\Helper',
78
+    'loginName2UserName'
79 79
 );
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
 $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
40 40
 $configPrefixes = $helper->getServerConfigurationPrefixes(true);
41
-if(count($configPrefixes) > 0) {
41
+if (count($configPrefixes) > 0) {
42 42
 	$ldapWrapper = new OCA\User_LDAP\LDAP();
43 43
 	$ocConfig = \OC::$server->getConfig();
44 44
 	$notificationManager = \OC::$server->getNotificationManager();
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
 	$userPluginManager = \OC::$server->query('LDAPUserPluginManager');
59 59
 	$groupPluginManager = \OC::$server->query('LDAPGroupPluginManager');
60 60
 
61
-	$userBackend  = new OCA\User_LDAP\User_Proxy(
61
+	$userBackend = new OCA\User_LDAP\User_Proxy(
62 62
 		$configPrefixes, $ldapWrapper, $ocConfig, $notificationManager, $userSession, $userPluginManager
63 63
 	);
64
-	$groupBackend  = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper, $groupPluginManager);
64
+	$groupBackend = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper, $groupPluginManager);
65 65
 	// register user backend
66 66
 	OC_User::useBackend($userBackend);
67 67
 
Please login to merge, or discard this patch.
apps/user_ldap/lib/User_Proxy.php 2 patches
Indentation   +286 added lines, -286 removed lines patch added patch discarded remove patch
@@ -37,314 +37,314 @@
 block discarded – undo
37 37
 use OCP\Notification\IManager as INotificationManager;
38 38
 
39 39
 class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface, IUserLDAP {
40
-	private $backends = array();
41
-	private $refBackend = null;
40
+    private $backends = array();
41
+    private $refBackend = null;
42 42
 
43
-	/**
44
-	 * Constructor
45
-	 *
46
-	 * @param array $serverConfigPrefixes array containing the config Prefixes
47
-	 * @param ILDAPWrapper $ldap
48
-	 * @param IConfig $ocConfig
49
-	 * @param INotificationManager $notificationManager
50
-	 * @param IUserSession $userSession
51
-	 */
52
-	public function __construct(array $serverConfigPrefixes, ILDAPWrapper $ldap, IConfig $ocConfig,
53
-		INotificationManager $notificationManager, IUserSession $userSession,
54
-								UserPluginManager $userPluginManager) {
55
-		parent::__construct($ldap);
56
-		foreach($serverConfigPrefixes as $configPrefix) {
57
-			$this->backends[$configPrefix] =
58
-				new User_LDAP($this->getAccess($configPrefix), $ocConfig, $notificationManager, $userSession, $userPluginManager);
43
+    /**
44
+     * Constructor
45
+     *
46
+     * @param array $serverConfigPrefixes array containing the config Prefixes
47
+     * @param ILDAPWrapper $ldap
48
+     * @param IConfig $ocConfig
49
+     * @param INotificationManager $notificationManager
50
+     * @param IUserSession $userSession
51
+     */
52
+    public function __construct(array $serverConfigPrefixes, ILDAPWrapper $ldap, IConfig $ocConfig,
53
+        INotificationManager $notificationManager, IUserSession $userSession,
54
+                                UserPluginManager $userPluginManager) {
55
+        parent::__construct($ldap);
56
+        foreach($serverConfigPrefixes as $configPrefix) {
57
+            $this->backends[$configPrefix] =
58
+                new User_LDAP($this->getAccess($configPrefix), $ocConfig, $notificationManager, $userSession, $userPluginManager);
59 59
 
60
-			if(is_null($this->refBackend)) {
61
-				$this->refBackend = &$this->backends[$configPrefix];
62
-			}
63
-		}
64
-	}
60
+            if(is_null($this->refBackend)) {
61
+                $this->refBackend = &$this->backends[$configPrefix];
62
+            }
63
+        }
64
+    }
65 65
 
66
-	/**
67
-	 * Tries the backends one after the other until a positive result is returned from the specified method
68
-	 * @param string $uid the uid connected to the request
69
-	 * @param string $method the method of the user backend that shall be called
70
-	 * @param array $parameters an array of parameters to be passed
71
-	 * @return mixed the result of the method or false
72
-	 */
73
-	protected function walkBackends($uid, $method, $parameters) {
74
-		$cacheKey = $this->getUserCacheKey($uid);
75
-		foreach($this->backends as $configPrefix => $backend) {
76
-			$instance = $backend;
77
-			if(!method_exists($instance, $method)
78
-				&& method_exists($this->getAccess($configPrefix), $method)) {
79
-				$instance = $this->getAccess($configPrefix);
80
-			}
81
-			if($result = call_user_func_array(array($instance, $method), $parameters)) {
82
-				$this->writeToCache($cacheKey, $configPrefix);
83
-				return $result;
84
-			}
85
-		}
86
-		return false;
87
-	}
66
+    /**
67
+     * Tries the backends one after the other until a positive result is returned from the specified method
68
+     * @param string $uid the uid connected to the request
69
+     * @param string $method the method of the user backend that shall be called
70
+     * @param array $parameters an array of parameters to be passed
71
+     * @return mixed the result of the method or false
72
+     */
73
+    protected function walkBackends($uid, $method, $parameters) {
74
+        $cacheKey = $this->getUserCacheKey($uid);
75
+        foreach($this->backends as $configPrefix => $backend) {
76
+            $instance = $backend;
77
+            if(!method_exists($instance, $method)
78
+                && method_exists($this->getAccess($configPrefix), $method)) {
79
+                $instance = $this->getAccess($configPrefix);
80
+            }
81
+            if($result = call_user_func_array(array($instance, $method), $parameters)) {
82
+                $this->writeToCache($cacheKey, $configPrefix);
83
+                return $result;
84
+            }
85
+        }
86
+        return false;
87
+    }
88 88
 
89
-	/**
90
-	 * Asks the backend connected to the server that supposely takes care of the uid from the request.
91
-	 * @param string $uid the uid connected to the request
92
-	 * @param string $method the method of the user backend that shall be called
93
-	 * @param array $parameters an array of parameters to be passed
94
-	 * @param mixed $passOnWhen the result matches this variable
95
-	 * @return mixed the result of the method or false
96
-	 */
97
-	protected function callOnLastSeenOn($uid, $method, $parameters, $passOnWhen) {
98
-		$cacheKey = $this->getUserCacheKey($uid);
99
-		$prefix = $this->getFromCache($cacheKey);
100
-		//in case the uid has been found in the past, try this stored connection first
101
-		if(!is_null($prefix)) {
102
-			if(isset($this->backends[$prefix])) {
103
-				$instance = $this->backends[$prefix];
104
-				if(!method_exists($instance, $method)
105
-					&& method_exists($this->getAccess($prefix), $method)) {
106
-					$instance = $this->getAccess($prefix);
107
-				}
108
-				$result = call_user_func_array(array($instance, $method), $parameters);
109
-				if($result === $passOnWhen) {
110
-					//not found here, reset cache to null if user vanished
111
-					//because sometimes methods return false with a reason
112
-					$userExists = call_user_func_array(
113
-						array($this->backends[$prefix], 'userExists'),
114
-						array($uid)
115
-					);
116
-					if(!$userExists) {
117
-						$this->writeToCache($cacheKey, null);
118
-					}
119
-				}
120
-				return $result;
121
-			}
122
-		}
123
-		return false;
124
-	}
89
+    /**
90
+     * Asks the backend connected to the server that supposely takes care of the uid from the request.
91
+     * @param string $uid the uid connected to the request
92
+     * @param string $method the method of the user backend that shall be called
93
+     * @param array $parameters an array of parameters to be passed
94
+     * @param mixed $passOnWhen the result matches this variable
95
+     * @return mixed the result of the method or false
96
+     */
97
+    protected function callOnLastSeenOn($uid, $method, $parameters, $passOnWhen) {
98
+        $cacheKey = $this->getUserCacheKey($uid);
99
+        $prefix = $this->getFromCache($cacheKey);
100
+        //in case the uid has been found in the past, try this stored connection first
101
+        if(!is_null($prefix)) {
102
+            if(isset($this->backends[$prefix])) {
103
+                $instance = $this->backends[$prefix];
104
+                if(!method_exists($instance, $method)
105
+                    && method_exists($this->getAccess($prefix), $method)) {
106
+                    $instance = $this->getAccess($prefix);
107
+                }
108
+                $result = call_user_func_array(array($instance, $method), $parameters);
109
+                if($result === $passOnWhen) {
110
+                    //not found here, reset cache to null if user vanished
111
+                    //because sometimes methods return false with a reason
112
+                    $userExists = call_user_func_array(
113
+                        array($this->backends[$prefix], 'userExists'),
114
+                        array($uid)
115
+                    );
116
+                    if(!$userExists) {
117
+                        $this->writeToCache($cacheKey, null);
118
+                    }
119
+                }
120
+                return $result;
121
+            }
122
+        }
123
+        return false;
124
+    }
125 125
 
126
-	/**
127
-	 * Check if backend implements actions
128
-	 * @param int $actions bitwise-or'ed actions
129
-	 * @return boolean
130
-	 *
131
-	 * Returns the supported actions as int to be
132
-	 * compared with \OC\User\Backend::CREATE_USER etc.
133
-	 */
134
-	public function implementsActions($actions) {
135
-		//it's the same across all our user backends obviously
136
-		return $this->refBackend->implementsActions($actions);
137
-	}
126
+    /**
127
+     * Check if backend implements actions
128
+     * @param int $actions bitwise-or'ed actions
129
+     * @return boolean
130
+     *
131
+     * Returns the supported actions as int to be
132
+     * compared with \OC\User\Backend::CREATE_USER etc.
133
+     */
134
+    public function implementsActions($actions) {
135
+        //it's the same across all our user backends obviously
136
+        return $this->refBackend->implementsActions($actions);
137
+    }
138 138
 
139
-	/**
140
-	 * Backend name to be shown in user management
141
-	 * @return string the name of the backend to be shown
142
-	 */
143
-	public function getBackendName() {
144
-		return $this->refBackend->getBackendName();
145
-	}
139
+    /**
140
+     * Backend name to be shown in user management
141
+     * @return string the name of the backend to be shown
142
+     */
143
+    public function getBackendName() {
144
+        return $this->refBackend->getBackendName();
145
+    }
146 146
 
147
-	/**
148
-	 * Get a list of all users
149
-	 *
150
-	 * @param string $search
151
-	 * @param null|int $limit
152
-	 * @param null|int $offset
153
-	 * @return string[] an array of all uids
154
-	 */
155
-	public function getUsers($search = '', $limit = 10, $offset = 0) {
156
-		//we do it just as the /OC_User implementation: do not play around with limit and offset but ask all backends
157
-		$users = array();
158
-		foreach($this->backends as $backend) {
159
-			$backendUsers = $backend->getUsers($search, $limit, $offset);
160
-			if (is_array($backendUsers)) {
161
-				$users = array_merge($users, $backendUsers);
162
-			}
163
-		}
164
-		return $users;
165
-	}
147
+    /**
148
+     * Get a list of all users
149
+     *
150
+     * @param string $search
151
+     * @param null|int $limit
152
+     * @param null|int $offset
153
+     * @return string[] an array of all uids
154
+     */
155
+    public function getUsers($search = '', $limit = 10, $offset = 0) {
156
+        //we do it just as the /OC_User implementation: do not play around with limit and offset but ask all backends
157
+        $users = array();
158
+        foreach($this->backends as $backend) {
159
+            $backendUsers = $backend->getUsers($search, $limit, $offset);
160
+            if (is_array($backendUsers)) {
161
+                $users = array_merge($users, $backendUsers);
162
+            }
163
+        }
164
+        return $users;
165
+    }
166 166
 
167
-	/**
168
-	 * check if a user exists
169
-	 * @param string $uid the username
170
-	 * @return boolean
171
-	 */
172
-	public function userExists($uid) {
173
-		return $this->handleRequest($uid, 'userExists', array($uid));
174
-	}
167
+    /**
168
+     * check if a user exists
169
+     * @param string $uid the username
170
+     * @return boolean
171
+     */
172
+    public function userExists($uid) {
173
+        return $this->handleRequest($uid, 'userExists', array($uid));
174
+    }
175 175
 
176
-	/**
177
-	 * check if a user exists on LDAP
178
-	 * @param string|\OCA\User_LDAP\User\User $user either the Nextcloud user
179
-	 * name or an instance of that user
180
-	 * @return boolean
181
-	 */
182
-	public function userExistsOnLDAP($user) {
183
-		$id = ($user instanceof User) ? $user->getUsername() : $user;
184
-		return $this->handleRequest($id, 'userExistsOnLDAP', array($user));
185
-	}
176
+    /**
177
+     * check if a user exists on LDAP
178
+     * @param string|\OCA\User_LDAP\User\User $user either the Nextcloud user
179
+     * name or an instance of that user
180
+     * @return boolean
181
+     */
182
+    public function userExistsOnLDAP($user) {
183
+        $id = ($user instanceof User) ? $user->getUsername() : $user;
184
+        return $this->handleRequest($id, 'userExistsOnLDAP', array($user));
185
+    }
186 186
 
187
-	/**
188
-	 * Check if the password is correct
189
-	 * @param string $uid The username
190
-	 * @param string $password The password
191
-	 * @return bool
192
-	 *
193
-	 * Check if the password is correct without logging in the user
194
-	 */
195
-	public function checkPassword($uid, $password) {
196
-		return $this->handleRequest($uid, 'checkPassword', array($uid, $password));
197
-	}
187
+    /**
188
+     * Check if the password is correct
189
+     * @param string $uid The username
190
+     * @param string $password The password
191
+     * @return bool
192
+     *
193
+     * Check if the password is correct without logging in the user
194
+     */
195
+    public function checkPassword($uid, $password) {
196
+        return $this->handleRequest($uid, 'checkPassword', array($uid, $password));
197
+    }
198 198
 
199
-	/**
200
-	 * returns the username for the given login name, if available
201
-	 *
202
-	 * @param string $loginName
203
-	 * @return string|false
204
-	 */
205
-	public function loginName2UserName($loginName) {
206
-		$id = 'LOGINNAME,' . $loginName;
207
-		return $this->handleRequest($id, 'loginName2UserName', array($loginName));
208
-	}
199
+    /**
200
+     * returns the username for the given login name, if available
201
+     *
202
+     * @param string $loginName
203
+     * @return string|false
204
+     */
205
+    public function loginName2UserName($loginName) {
206
+        $id = 'LOGINNAME,' . $loginName;
207
+        return $this->handleRequest($id, 'loginName2UserName', array($loginName));
208
+    }
209 209
 	
210
-	/**
211
-	 * returns the username for the given LDAP DN, if available
212
-	 *
213
-	 * @param string $dn
214
-	 * @return string|false with the username
215
-	 */
216
-	public function dn2UserName($dn) {
217
-		$id = 'DN,' . $dn;
218
-		return $this->handleRequest($id, 'dn2UserName', array($dn));
219
-	}
210
+    /**
211
+     * returns the username for the given LDAP DN, if available
212
+     *
213
+     * @param string $dn
214
+     * @return string|false with the username
215
+     */
216
+    public function dn2UserName($dn) {
217
+        $id = 'DN,' . $dn;
218
+        return $this->handleRequest($id, 'dn2UserName', array($dn));
219
+    }
220 220
 
221
-	/**
222
-	 * get the user's home directory
223
-	 * @param string $uid the username
224
-	 * @return boolean
225
-	 */
226
-	public function getHome($uid) {
227
-		return $this->handleRequest($uid, 'getHome', array($uid));
228
-	}
221
+    /**
222
+     * get the user's home directory
223
+     * @param string $uid the username
224
+     * @return boolean
225
+     */
226
+    public function getHome($uid) {
227
+        return $this->handleRequest($uid, 'getHome', array($uid));
228
+    }
229 229
 
230
-	/**
231
-	 * get display name of the user
232
-	 * @param string $uid user ID of the user
233
-	 * @return string display name
234
-	 */
235
-	public function getDisplayName($uid) {
236
-		return $this->handleRequest($uid, 'getDisplayName', array($uid));
237
-	}
230
+    /**
231
+     * get display name of the user
232
+     * @param string $uid user ID of the user
233
+     * @return string display name
234
+     */
235
+    public function getDisplayName($uid) {
236
+        return $this->handleRequest($uid, 'getDisplayName', array($uid));
237
+    }
238 238
 
239
-	/**
240
-	 * set display name of the user
241
-	 *
242
-	 * @param string $uid user ID of the user
243
-	 * @param string $displayName new display name
244
-	 * @return string display name
245
-	 */
246
-	public function setDisplayName($uid, $displayName) {
247
-		return $this->handleRequest($uid, 'setDisplayName', array($uid, $displayName));
248
-	}
239
+    /**
240
+     * set display name of the user
241
+     *
242
+     * @param string $uid user ID of the user
243
+     * @param string $displayName new display name
244
+     * @return string display name
245
+     */
246
+    public function setDisplayName($uid, $displayName) {
247
+        return $this->handleRequest($uid, 'setDisplayName', array($uid, $displayName));
248
+    }
249 249
 
250
-	/**
251
-	 * checks whether the user is allowed to change his avatar in Nextcloud
252
-	 * @param string $uid the Nextcloud user name
253
-	 * @return boolean either the user can or cannot
254
-	 */
255
-	public function canChangeAvatar($uid) {
256
-		return $this->handleRequest($uid, 'canChangeAvatar', array($uid));
257
-	}
250
+    /**
251
+     * checks whether the user is allowed to change his avatar in Nextcloud
252
+     * @param string $uid the Nextcloud user name
253
+     * @return boolean either the user can or cannot
254
+     */
255
+    public function canChangeAvatar($uid) {
256
+        return $this->handleRequest($uid, 'canChangeAvatar', array($uid));
257
+    }
258 258
 
259
-	/**
260
-	 * Get a list of all display names and user ids.
261
-	 * @param string $search
262
-	 * @param string|null $limit
263
-	 * @param string|null $offset
264
-	 * @return array an array of all displayNames (value) and the corresponding uids (key)
265
-	 */
266
-	public function getDisplayNames($search = '', $limit = null, $offset = null) {
267
-		//we do it just as the /OC_User implementation: do not play around with limit and offset but ask all backends
268
-		$users = array();
269
-		foreach($this->backends as $backend) {
270
-			$backendUsers = $backend->getDisplayNames($search, $limit, $offset);
271
-			if (is_array($backendUsers)) {
272
-				$users = $users + $backendUsers;
273
-			}
274
-		}
275
-		return $users;
276
-	}
259
+    /**
260
+     * Get a list of all display names and user ids.
261
+     * @param string $search
262
+     * @param string|null $limit
263
+     * @param string|null $offset
264
+     * @return array an array of all displayNames (value) and the corresponding uids (key)
265
+     */
266
+    public function getDisplayNames($search = '', $limit = null, $offset = null) {
267
+        //we do it just as the /OC_User implementation: do not play around with limit and offset but ask all backends
268
+        $users = array();
269
+        foreach($this->backends as $backend) {
270
+            $backendUsers = $backend->getDisplayNames($search, $limit, $offset);
271
+            if (is_array($backendUsers)) {
272
+                $users = $users + $backendUsers;
273
+            }
274
+        }
275
+        return $users;
276
+    }
277 277
 
278
-	/**
279
-	 * delete a user
280
-	 * @param string $uid The username of the user to delete
281
-	 * @return bool
282
-	 *
283
-	 * Deletes a user
284
-	 */
285
-	public function deleteUser($uid) {
286
-		return $this->handleRequest($uid, 'deleteUser', array($uid));
287
-	}
278
+    /**
279
+     * delete a user
280
+     * @param string $uid The username of the user to delete
281
+     * @return bool
282
+     *
283
+     * Deletes a user
284
+     */
285
+    public function deleteUser($uid) {
286
+        return $this->handleRequest($uid, 'deleteUser', array($uid));
287
+    }
288 288
 	
289
-	/**
290
-	 * Set password
291
-	 * @param string $uid The username
292
-	 * @param string $password The new password
293
-	 * @return bool
294
-	 *
295
-	 */
296
-	public function setPassword($uid, $password) {
297
-		return $this->handleRequest($uid, 'setPassword', array($uid, $password));
298
-	}
289
+    /**
290
+     * Set password
291
+     * @param string $uid The username
292
+     * @param string $password The new password
293
+     * @return bool
294
+     *
295
+     */
296
+    public function setPassword($uid, $password) {
297
+        return $this->handleRequest($uid, 'setPassword', array($uid, $password));
298
+    }
299 299
 
300
-	/**
301
-	 * @return bool
302
-	 */
303
-	public function hasUserListings() {
304
-		return $this->refBackend->hasUserListings();
305
-	}
300
+    /**
301
+     * @return bool
302
+     */
303
+    public function hasUserListings() {
304
+        return $this->refBackend->hasUserListings();
305
+    }
306 306
 
307
-	/**
308
-	 * Count the number of users
309
-	 * @return int|bool
310
-	 */
311
-	public function countUsers() {
312
-		$users = false;
313
-		foreach($this->backends as $backend) {
314
-			$backendUsers = $backend->countUsers();
315
-			if ($backendUsers !== false) {
316
-				$users += $backendUsers;
317
-			}
318
-		}
319
-		return $users;
320
-	}
307
+    /**
308
+     * Count the number of users
309
+     * @return int|bool
310
+     */
311
+    public function countUsers() {
312
+        $users = false;
313
+        foreach($this->backends as $backend) {
314
+            $backendUsers = $backend->countUsers();
315
+            if ($backendUsers !== false) {
316
+                $users += $backendUsers;
317
+            }
318
+        }
319
+        return $users;
320
+    }
321 321
 
322
-	/**
323
-	 * Return access for LDAP interaction.
324
-	 * @param string $uid
325
-	 * @return Access instance of Access for LDAP interaction
326
-	 */
327
-	public function getLDAPAccess($uid) {
328
-		return $this->handleRequest($uid, 'getLDAPAccess', array($uid));
329
-	}
322
+    /**
323
+     * Return access for LDAP interaction.
324
+     * @param string $uid
325
+     * @return Access instance of Access for LDAP interaction
326
+     */
327
+    public function getLDAPAccess($uid) {
328
+        return $this->handleRequest($uid, 'getLDAPAccess', array($uid));
329
+    }
330 330
 	
331
-	/**
332
-	 * Return a new LDAP connection for the specified user.
333
-	 * The connection needs to be closed manually.
334
-	 * @param string $uid
335
-	 * @return resource of the LDAP connection
336
-	 */
337
-	public function getNewLDAPConnection($uid) {
338
-		return $this->handleRequest($uid, 'getNewLDAPConnection', array($uid));
339
-	}
331
+    /**
332
+     * Return a new LDAP connection for the specified user.
333
+     * The connection needs to be closed manually.
334
+     * @param string $uid
335
+     * @return resource of the LDAP connection
336
+     */
337
+    public function getNewLDAPConnection($uid) {
338
+        return $this->handleRequest($uid, 'getNewLDAPConnection', array($uid));
339
+    }
340 340
 
341
-	/**
342
-	 * Creates a new user in LDAP
343
-	 * @param $username
344
-	 * @param $password
345
-	 * @return bool
346
-	 */
347
-	public function createUser($username, $password) {
348
-		return $this->handleRequest($username, 'createUser', array($username,$password));
349
-	}
341
+    /**
342
+     * Creates a new user in LDAP
343
+     * @param $username
344
+     * @param $password
345
+     * @return bool
346
+     */
347
+    public function createUser($username, $password) {
348
+        return $this->handleRequest($username, 'createUser', array($username,$password));
349
+    }
350 350
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
 		INotificationManager $notificationManager, IUserSession $userSession,
54 54
 								UserPluginManager $userPluginManager) {
55 55
 		parent::__construct($ldap);
56
-		foreach($serverConfigPrefixes as $configPrefix) {
56
+		foreach ($serverConfigPrefixes as $configPrefix) {
57 57
 			$this->backends[$configPrefix] =
58 58
 				new User_LDAP($this->getAccess($configPrefix), $ocConfig, $notificationManager, $userSession, $userPluginManager);
59 59
 
60
-			if(is_null($this->refBackend)) {
60
+			if (is_null($this->refBackend)) {
61 61
 				$this->refBackend = &$this->backends[$configPrefix];
62 62
 			}
63 63
 		}
@@ -72,13 +72,13 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	protected function walkBackends($uid, $method, $parameters) {
74 74
 		$cacheKey = $this->getUserCacheKey($uid);
75
-		foreach($this->backends as $configPrefix => $backend) {
75
+		foreach ($this->backends as $configPrefix => $backend) {
76 76
 			$instance = $backend;
77
-			if(!method_exists($instance, $method)
77
+			if (!method_exists($instance, $method)
78 78
 				&& method_exists($this->getAccess($configPrefix), $method)) {
79 79
 				$instance = $this->getAccess($configPrefix);
80 80
 			}
81
-			if($result = call_user_func_array(array($instance, $method), $parameters)) {
81
+			if ($result = call_user_func_array(array($instance, $method), $parameters)) {
82 82
 				$this->writeToCache($cacheKey, $configPrefix);
83 83
 				return $result;
84 84
 			}
@@ -98,22 +98,22 @@  discard block
 block discarded – undo
98 98
 		$cacheKey = $this->getUserCacheKey($uid);
99 99
 		$prefix = $this->getFromCache($cacheKey);
100 100
 		//in case the uid has been found in the past, try this stored connection first
101
-		if(!is_null($prefix)) {
102
-			if(isset($this->backends[$prefix])) {
101
+		if (!is_null($prefix)) {
102
+			if (isset($this->backends[$prefix])) {
103 103
 				$instance = $this->backends[$prefix];
104
-				if(!method_exists($instance, $method)
104
+				if (!method_exists($instance, $method)
105 105
 					&& method_exists($this->getAccess($prefix), $method)) {
106 106
 					$instance = $this->getAccess($prefix);
107 107
 				}
108 108
 				$result = call_user_func_array(array($instance, $method), $parameters);
109
-				if($result === $passOnWhen) {
109
+				if ($result === $passOnWhen) {
110 110
 					//not found here, reset cache to null if user vanished
111 111
 					//because sometimes methods return false with a reason
112 112
 					$userExists = call_user_func_array(
113 113
 						array($this->backends[$prefix], 'userExists'),
114 114
 						array($uid)
115 115
 					);
116
-					if(!$userExists) {
116
+					if (!$userExists) {
117 117
 						$this->writeToCache($cacheKey, null);
118 118
 					}
119 119
 				}
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	public function getUsers($search = '', $limit = 10, $offset = 0) {
156 156
 		//we do it just as the /OC_User implementation: do not play around with limit and offset but ask all backends
157 157
 		$users = array();
158
-		foreach($this->backends as $backend) {
158
+		foreach ($this->backends as $backend) {
159 159
 			$backendUsers = $backend->getUsers($search, $limit, $offset);
160 160
 			if (is_array($backendUsers)) {
161 161
 				$users = array_merge($users, $backendUsers);
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 * @return string|false
204 204
 	 */
205 205
 	public function loginName2UserName($loginName) {
206
-		$id = 'LOGINNAME,' . $loginName;
206
+		$id = 'LOGINNAME,'.$loginName;
207 207
 		return $this->handleRequest($id, 'loginName2UserName', array($loginName));
208 208
 	}
209 209
 	
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 	 * @return string|false with the username
215 215
 	 */
216 216
 	public function dn2UserName($dn) {
217
-		$id = 'DN,' . $dn;
217
+		$id = 'DN,'.$dn;
218 218
 		return $this->handleRequest($id, 'dn2UserName', array($dn));
219 219
 	}
220 220
 
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 	public function getDisplayNames($search = '', $limit = null, $offset = null) {
267 267
 		//we do it just as the /OC_User implementation: do not play around with limit and offset but ask all backends
268 268
 		$users = array();
269
-		foreach($this->backends as $backend) {
269
+		foreach ($this->backends as $backend) {
270 270
 			$backendUsers = $backend->getDisplayNames($search, $limit, $offset);
271 271
 			if (is_array($backendUsers)) {
272 272
 				$users = $users + $backendUsers;
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 	 */
311 311
 	public function countUsers() {
312 312
 		$users = false;
313
-		foreach($this->backends as $backend) {
313
+		foreach ($this->backends as $backend) {
314 314
 			$backendUsers = $backend->countUsers();
315 315
 			if ($backendUsers !== false) {
316 316
 				$users += $backendUsers;
@@ -345,6 +345,6 @@  discard block
 block discarded – undo
345 345
 	 * @return bool
346 346
 	 */
347 347
 	public function createUser($username, $password) {
348
-		return $this->handleRequest($username, 'createUser', array($username,$password));
348
+		return $this->handleRequest($username, 'createUser', array($username, $password));
349 349
 	}
350 350
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Migration/UUIDFixGroup.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@
 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
-			\OC::$server->getNotificationManager(), \OC::$server->getUserSession(),
37
-			\OC::$server->query('LDAPUserPluginManager'));
38
-	}
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
+            \OC::$server->getNotificationManager(), \OC::$server->getUserSession(),
37
+            \OC::$server->query('LDAPUserPluginManager'));
38
+    }
39 39
 }
Please login to merge, or discard this patch.