Completed
Push — stable13 ( 922c2c...c99529 )
by John
50:37 queued 22:46
created
apps/user_ldap/ajax/deleteConfiguration.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@
 block discarded – undo
34 34
 $prefix = (string)$_POST['ldap_serverconfig_chooser'];
35 35
 $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
36 36
 if($helper->deleteServerConfiguration($prefix)) {
37
-	OCP\JSON::success();
37
+    OCP\JSON::success();
38 38
 } else {
39
-	$l = \OC::$server->getL10N('user_ldap');
40
-	OCP\JSON::error(array('message' => $l->t('Failed to delete the server configuration')));
39
+    $l = \OC::$server->getL10N('user_ldap');
40
+    OCP\JSON::error(array('message' => $l->t('Failed to delete the server configuration')));
41 41
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,9 +31,9 @@
 block discarded – undo
31 31
 OCP\JSON::checkAppEnabled('user_ldap');
32 32
 OCP\JSON::callCheck();
33 33
 
34
-$prefix = (string)$_POST['ldap_serverconfig_chooser'];
34
+$prefix = (string) $_POST['ldap_serverconfig_chooser'];
35 35
 $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig());
36
-if($helper->deleteServerConfiguration($prefix)) {
36
+if ($helper->deleteServerConfiguration($prefix)) {
37 37
 	OCP\JSON::success();
38 38
 } else {
39 39
 	$l = \OC::$server->getL10N('user_ldap');
Please login to merge, or discard this patch.
apps/user_ldap/ajax/wizard.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,16 +32,16 @@  discard block
 block discarded – undo
32 32
 
33 33
 $l = \OC::$server->getL10N('user_ldap');
34 34
 
35
-if(!isset($_POST['action'])) {
35
+if (!isset($_POST['action'])) {
36 36
 	\OCP\JSON::error(array('message' => $l->t('No action specified')));
37 37
 }
38
-$action = (string)$_POST['action'];
38
+$action = (string) $_POST['action'];
39 39
 
40 40
 
41
-if(!isset($_POST['ldap_serverconfig_chooser'])) {
41
+if (!isset($_POST['ldap_serverconfig_chooser'])) {
42 42
 	\OCP\JSON::error(array('message' => $l->t('No configuration specified')));
43 43
 }
44
-$prefix = (string)$_POST['ldap_serverconfig_chooser'];
44
+$prefix = (string) $_POST['ldap_serverconfig_chooser'];
45 45
 
46 46
 $ldapWrapper = new \OCA\User_LDAP\LDAP();
47 47
 $configuration = new \OCA\User_LDAP\Configuration($prefix);
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
 $wizard = new \OCA\User_LDAP\Wizard($configuration, $ldapWrapper, $access);
68 68
 
69
-switch($action) {
69
+switch ($action) {
70 70
 	case 'guessPortAndTLS':
71 71
 	case 'guessBaseDN':
72 72
 	case 'detectEmailAttribute':
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	case 'countInBaseDN':
86 86
 		try {
87 87
 			$result = $wizard->$action();
88
-			if($result !== false) {
88
+			if ($result !== false) {
89 89
 				OCP\JSON::success($result->getResultArray());
90 90
 				exit;
91 91
 			}
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		try {
102 102
 			$loginName = $_POST['ldap_test_loginname'];
103 103
 			$result = $wizard->$action($loginName);
104
-			if($result !== false) {
104
+			if ($result !== false) {
105 105
 				OCP\JSON::success($result->getResultArray());
106 106
 				exit;
107 107
 			}
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
 	case 'save':
118 118
 		$key = isset($_POST['cfgkey']) ? $_POST['cfgkey'] : false;
119 119
 		$val = isset($_POST['cfgval']) ? $_POST['cfgval'] : null;
120
-		if($key === false || is_null($val)) {
120
+		if ($key === false || is_null($val)) {
121 121
 			\OCP\JSON::error(array('message' => $l->t('No data specified')));
122 122
 			exit;
123 123
 		}
124 124
 		$cfg = array($key => $val);
125 125
 		$setParameters = array();
126 126
 		$configuration->setConfiguration($cfg, $setParameters);
127
-		if(!in_array($key, $setParameters)) {
127
+		if (!in_array($key, $setParameters)) {
128 128
 			\OCP\JSON::error(array('message' => $l->t($key.
129 129
 				' Could not set configuration %s', $setParameters[0])));
130 130
 			exit;
Please login to merge, or discard this patch.
Indentation   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -36,13 +36,13 @@  discard block
 block discarded – undo
36 36
 $l = \OC::$server->getL10N('user_ldap');
37 37
 
38 38
 if(!isset($_POST['action'])) {
39
-	\OCP\JSON::error(array('message' => $l->t('No action specified')));
39
+    \OCP\JSON::error(array('message' => $l->t('No action specified')));
40 40
 }
41 41
 $action = (string)$_POST['action'];
42 42
 
43 43
 
44 44
 if(!isset($_POST['ldap_serverconfig_chooser'])) {
45
-	\OCP\JSON::error(array('message' => $l->t('No configuration specified')));
45
+    \OCP\JSON::error(array('message' => $l->t('No configuration specified')));
46 46
 }
47 47
 $prefix = (string)$_POST['ldap_serverconfig_chooser'];
48 48
 
@@ -55,95 +55,95 @@  discard block
 block discarded – undo
55 55
 $con->setIgnoreValidation(true);
56 56
 
57 57
 $userManager = new \OCA\User_LDAP\User\Manager(
58
-	\OC::$server->getConfig(),
59
-	new \OCA\User_LDAP\FilesystemHelper(),
60
-	new \OCA\User_LDAP\LogWrapper(),
61
-	\OC::$server->getAvatarManager(),
62
-	new \OCP\Image(),
63
-	\OC::$server->getDatabaseConnection(),
64
-	\OC::$server->getUserManager(),
65
-	\OC::$server->getNotificationManager());
58
+    \OC::$server->getConfig(),
59
+    new \OCA\User_LDAP\FilesystemHelper(),
60
+    new \OCA\User_LDAP\LogWrapper(),
61
+    \OC::$server->getAvatarManager(),
62
+    new \OCP\Image(),
63
+    \OC::$server->getDatabaseConnection(),
64
+    \OC::$server->getUserManager(),
65
+    \OC::$server->getNotificationManager());
66 66
 
67 67
 $access = new \OCA\User_LDAP\Access(
68
-	$con,
69
-	$ldapWrapper,
70
-	$userManager,
71
-	new \OCA\User_LDAP\Helper(\OC::$server->getConfig()),
72
-	\OC::$server->getConfig()
68
+    $con,
69
+    $ldapWrapper,
70
+    $userManager,
71
+    new \OCA\User_LDAP\Helper(\OC::$server->getConfig()),
72
+    \OC::$server->getConfig()
73 73
 );
74 74
 
75 75
 $wizard = new \OCA\User_LDAP\Wizard($configuration, $ldapWrapper, $access);
76 76
 
77 77
 switch($action) {
78
-	case 'guessPortAndTLS':
79
-	case 'guessBaseDN':
80
-	case 'detectEmailAttribute':
81
-	case 'detectUserDisplayNameAttribute':
82
-	case 'determineGroupMemberAssoc':
83
-	case 'determineUserObjectClasses':
84
-	case 'determineGroupObjectClasses':
85
-	case 'determineGroupsForUsers':
86
-	case 'determineGroupsForGroups':
87
-	case 'determineAttributes':
88
-	case 'getUserListFilter':
89
-	case 'getUserLoginFilter':
90
-	case 'getGroupFilter':
91
-	case 'countUsers':
92
-	case 'countGroups':
93
-	case 'countInBaseDN':
94
-		try {
95
-			$result = $wizard->$action();
96
-			if($result !== false) {
97
-				OCP\JSON::success($result->getResultArray());
98
-				exit;
99
-			}
100
-		} catch (\Exception $e) {
101
-			\OCP\JSON::error(array('message' => $e->getMessage(), 'code' => $e->getCode()));
102
-			exit;
103
-		}
104
-		\OCP\JSON::error();
105
-		exit;
106
-		break;
78
+    case 'guessPortAndTLS':
79
+    case 'guessBaseDN':
80
+    case 'detectEmailAttribute':
81
+    case 'detectUserDisplayNameAttribute':
82
+    case 'determineGroupMemberAssoc':
83
+    case 'determineUserObjectClasses':
84
+    case 'determineGroupObjectClasses':
85
+    case 'determineGroupsForUsers':
86
+    case 'determineGroupsForGroups':
87
+    case 'determineAttributes':
88
+    case 'getUserListFilter':
89
+    case 'getUserLoginFilter':
90
+    case 'getGroupFilter':
91
+    case 'countUsers':
92
+    case 'countGroups':
93
+    case 'countInBaseDN':
94
+        try {
95
+            $result = $wizard->$action();
96
+            if($result !== false) {
97
+                OCP\JSON::success($result->getResultArray());
98
+                exit;
99
+            }
100
+        } catch (\Exception $e) {
101
+            \OCP\JSON::error(array('message' => $e->getMessage(), 'code' => $e->getCode()));
102
+            exit;
103
+        }
104
+        \OCP\JSON::error();
105
+        exit;
106
+        break;
107 107
 
108
-	case 'testLoginName': {
109
-		try {
110
-			$loginName = $_POST['ldap_test_loginname'];
111
-			$result = $wizard->$action($loginName);
112
-			if($result !== false) {
113
-				OCP\JSON::success($result->getResultArray());
114
-				exit;
115
-			}
116
-		} catch (\Exception $e) {
117
-			\OCP\JSON::error(array('message' => $e->getMessage()));
118
-			exit;
119
-		}
120
-		\OCP\JSON::error();
121
-		exit;
122
-		break;
123
-	}
108
+    case 'testLoginName': {
109
+        try {
110
+            $loginName = $_POST['ldap_test_loginname'];
111
+            $result = $wizard->$action($loginName);
112
+            if($result !== false) {
113
+                OCP\JSON::success($result->getResultArray());
114
+                exit;
115
+            }
116
+        } catch (\Exception $e) {
117
+            \OCP\JSON::error(array('message' => $e->getMessage()));
118
+            exit;
119
+        }
120
+        \OCP\JSON::error();
121
+        exit;
122
+        break;
123
+    }
124 124
 
125
-	case 'save':
126
-		$key = isset($_POST['cfgkey']) ? $_POST['cfgkey'] : false;
127
-		$val = isset($_POST['cfgval']) ? $_POST['cfgval'] : null;
128
-		if($key === false || is_null($val)) {
129
-			\OCP\JSON::error(array('message' => $l->t('No data specified')));
130
-			exit;
131
-		}
132
-		$cfg = array($key => $val);
133
-		$setParameters = array();
134
-		$configuration->setConfiguration($cfg, $setParameters);
135
-		if(!in_array($key, $setParameters)) {
136
-			\OCP\JSON::error(array('message' => $l->t($key.
137
-				' Could not set configuration %s', $setParameters[0])));
138
-			exit;
139
-		}
140
-		$configuration->saveConfiguration();
141
-		//clear the cache on save
142
-		$connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix);
143
-		$connection->clearCache();
144
-		OCP\JSON::success();
145
-		break;
146
-	default:
147
-		\OCP\JSON::error(array('message' => $l->t('Action does not exist')));
148
-		break;
125
+    case 'save':
126
+        $key = isset($_POST['cfgkey']) ? $_POST['cfgkey'] : false;
127
+        $val = isset($_POST['cfgval']) ? $_POST['cfgval'] : null;
128
+        if($key === false || is_null($val)) {
129
+            \OCP\JSON::error(array('message' => $l->t('No data specified')));
130
+            exit;
131
+        }
132
+        $cfg = array($key => $val);
133
+        $setParameters = array();
134
+        $configuration->setConfiguration($cfg, $setParameters);
135
+        if(!in_array($key, $setParameters)) {
136
+            \OCP\JSON::error(array('message' => $l->t($key.
137
+                ' Could not set configuration %s', $setParameters[0])));
138
+            exit;
139
+        }
140
+        $configuration->saveConfiguration();
141
+        //clear the cache on save
142
+        $connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix);
143
+        $connection->clearCache();
144
+        OCP\JSON::success();
145
+        break;
146
+    default:
147
+        \OCP\JSON::error(array('message' => $l->t('Action does not exist')));
148
+        break;
149 149
 }
Please login to merge, or discard this patch.
apps/user_ldap/ajax/getNewServerConfigPrefix.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,12 +38,12 @@
 block discarded – undo
38 38
 
39 39
 $newConfig = new \OCA\User_LDAP\Configuration($nk, false);
40 40
 if(isset($_POST['copyConfig'])) {
41
-	$originalConfig = new \OCA\User_LDAP\Configuration($_POST['copyConfig']);
42
-	$newConfig->setConfiguration($originalConfig->getConfiguration());
41
+    $originalConfig = new \OCA\User_LDAP\Configuration($_POST['copyConfig']);
42
+    $newConfig->setConfiguration($originalConfig->getConfiguration());
43 43
 } else {
44
-	$configuration = new \OCA\User_LDAP\Configuration($nk, false);
45
-	$newConfig->setConfiguration($configuration->getDefaults());
46
-	$resultData['defaults'] = $configuration->getDefaults();
44
+    $configuration = new \OCA\User_LDAP\Configuration($nk, false);
45
+    $newConfig->setConfiguration($configuration->getDefaults());
46
+    $resultData['defaults'] = $configuration->getDefaults();
47 47
 }
48 48
 $newConfig->saveConfiguration();
49 49
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@
 block discarded – undo
32 32
 sort($serverConnections);
33 33
 $lk = array_pop($serverConnections);
34 34
 $ln = intval(str_replace('s', '', $lk));
35
-$nk = 's'.str_pad($ln+1, 2, '0', STR_PAD_LEFT);
35
+$nk = 's'.str_pad($ln + 1, 2, '0', STR_PAD_LEFT);
36 36
 
37 37
 $resultData = array('configPrefix' => $nk);
38 38
 
39 39
 $newConfig = new \OCA\User_LDAP\Configuration($nk, false);
40
-if(isset($_POST['copyConfig'])) {
40
+if (isset($_POST['copyConfig'])) {
41 41
 	$originalConfig = new \OCA\User_LDAP\Configuration($_POST['copyConfig']);
42 42
 	$newConfig->setConfiguration($originalConfig->getConfiguration());
43 43
 } else {
Please login to merge, or discard this patch.
apps/user_ldap/lib/Mapping/GroupMapping.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@
 block discarded – undo
29 29
 */
30 30
 class GroupMapping extends AbstractMapping {
31 31
 
32
-	/**
33
-	* returns the DB table name which holds the mappings
34
-	* @return string
35
-	*/
36
-	protected function getTableName() {
37
-		return '*PREFIX*ldap_group_mapping';
38
-	}
32
+    /**
33
+     * returns the DB table name which holds the mappings
34
+     * @return string
35
+     */
36
+    protected function getTableName() {
37
+        return '*PREFIX*ldap_group_mapping';
38
+    }
39 39
 
40 40
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/Mapping/UserMapping.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@
 block discarded – undo
29 29
 */
30 30
 class UserMapping extends AbstractMapping {
31 31
 
32
-	/**
33
-	 * returns the DB table name which holds the mappings
34
-	 * @return string
35
-	 */
36
-	protected function getTableName() {
37
-		return '*PREFIX*ldap_user_mapping';
38
-	}
32
+    /**
33
+     * returns the DB table name which holds the mappings
34
+     * @return string
35
+     */
36
+    protected function getTableName() {
37
+        return '*PREFIX*ldap_user_mapping';
38
+    }
39 39
 
40 40
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/User/DeletedUsersIndex.php 2 patches
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -31,84 +31,84 @@
 block discarded – undo
31 31
  * @package OCA\User_LDAP
32 32
  */
33 33
 class DeletedUsersIndex {
34
-	/**
35
-	 * @var \OCP\IConfig $config
36
-	 */
37
-	protected $config;
34
+    /**
35
+     * @var \OCP\IConfig $config
36
+     */
37
+    protected $config;
38 38
 
39
-	/**
40
-	 * @var \OCP\IDBConnection $db
41
-	 */
42
-	protected $db;
39
+    /**
40
+     * @var \OCP\IDBConnection $db
41
+     */
42
+    protected $db;
43 43
 
44
-	/**
45
-	 * @var \OCA\User_LDAP\Mapping\UserMapping $mapping
46
-	 */
47
-	protected $mapping;
44
+    /**
45
+     * @var \OCA\User_LDAP\Mapping\UserMapping $mapping
46
+     */
47
+    protected $mapping;
48 48
 
49
-	/**
50
-	 * @var array $deletedUsers
51
-	 */
52
-	protected $deletedUsers;
49
+    /**
50
+     * @var array $deletedUsers
51
+     */
52
+    protected $deletedUsers;
53 53
 
54
-	/**
55
-	 * @param \OCP\IConfig $config
56
-	 * @param \OCP\IDBConnection $db
57
-	 * @param \OCA\User_LDAP\Mapping\UserMapping $mapping
58
-	 */
59
-	public function __construct(\OCP\IConfig $config, \OCP\IDBConnection $db, UserMapping $mapping) {
60
-		$this->config = $config;
61
-		$this->db = $db;
62
-		$this->mapping = $mapping;
63
-	}
54
+    /**
55
+     * @param \OCP\IConfig $config
56
+     * @param \OCP\IDBConnection $db
57
+     * @param \OCA\User_LDAP\Mapping\UserMapping $mapping
58
+     */
59
+    public function __construct(\OCP\IConfig $config, \OCP\IDBConnection $db, UserMapping $mapping) {
60
+        $this->config = $config;
61
+        $this->db = $db;
62
+        $this->mapping = $mapping;
63
+    }
64 64
 
65
-	/**
66
-	 * reads LDAP users marked as deleted from the database
67
-	 * @return \OCA\User_LDAP\User\OfflineUser[]
68
-	 */
69
-	private function fetchDeletedUsers() {
70
-		$deletedUsers = $this->config->getUsersForUserValue(
71
-			'user_ldap', 'isDeleted', '1');
65
+    /**
66
+     * reads LDAP users marked as deleted from the database
67
+     * @return \OCA\User_LDAP\User\OfflineUser[]
68
+     */
69
+    private function fetchDeletedUsers() {
70
+        $deletedUsers = $this->config->getUsersForUserValue(
71
+            'user_ldap', 'isDeleted', '1');
72 72
 
73
-		$userObjects = array();
74
-		foreach($deletedUsers as $user) {
75
-			$userObjects[] = new OfflineUser($user, $this->config, $this->db, $this->mapping);
76
-		}
77
-		$this->deletedUsers = $userObjects;
73
+        $userObjects = array();
74
+        foreach($deletedUsers as $user) {
75
+            $userObjects[] = new OfflineUser($user, $this->config, $this->db, $this->mapping);
76
+        }
77
+        $this->deletedUsers = $userObjects;
78 78
 
79
-		return $this->deletedUsers;
80
-	}
79
+        return $this->deletedUsers;
80
+    }
81 81
 
82
-	/**
83
-	 * returns all LDAP users that are marked as deleted
84
-	 * @return \OCA\User_LDAP\User\OfflineUser[]
85
-	 */
86
-	public function getUsers() {
87
-		if(is_array($this->deletedUsers)) {
88
-			return $this->deletedUsers;
89
-		}
90
-		return $this->fetchDeletedUsers();
91
-	}
82
+    /**
83
+     * returns all LDAP users that are marked as deleted
84
+     * @return \OCA\User_LDAP\User\OfflineUser[]
85
+     */
86
+    public function getUsers() {
87
+        if(is_array($this->deletedUsers)) {
88
+            return $this->deletedUsers;
89
+        }
90
+        return $this->fetchDeletedUsers();
91
+    }
92 92
 
93
-	/**
94
-	 * whether at least one user was detected as deleted
95
-	 * @return bool
96
-	 */
97
-	public function hasUsers() {
98
-		if($this->deletedUsers === false) {
99
-			$this->fetchDeletedUsers();
100
-		}
101
-		if(is_array($this->deletedUsers) && count($this->deletedUsers) > 0) {
102
-			return true;
103
-		}
104
-		return false;
105
-	}
93
+    /**
94
+     * whether at least one user was detected as deleted
95
+     * @return bool
96
+     */
97
+    public function hasUsers() {
98
+        if($this->deletedUsers === false) {
99
+            $this->fetchDeletedUsers();
100
+        }
101
+        if(is_array($this->deletedUsers) && count($this->deletedUsers) > 0) {
102
+            return true;
103
+        }
104
+        return false;
105
+    }
106 106
 
107
-	/**
108
-	 * marks a user as deleted
109
-	 * @param string $ocName
110
-	 */
111
-	public function markUser($ocName) {
112
-		$this->config->setUserValue($ocName, 'user_ldap', 'isDeleted', '1');
113
-	}
107
+    /**
108
+     * marks a user as deleted
109
+     * @param string $ocName
110
+     */
111
+    public function markUser($ocName) {
112
+        $this->config->setUserValue($ocName, 'user_ldap', 'isDeleted', '1');
113
+    }
114 114
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 			'user_ldap', 'isDeleted', '1');
72 72
 
73 73
 		$userObjects = array();
74
-		foreach($deletedUsers as $user) {
74
+		foreach ($deletedUsers as $user) {
75 75
 			$userObjects[] = new OfflineUser($user, $this->config, $this->db, $this->mapping);
76 76
 		}
77 77
 		$this->deletedUsers = $userObjects;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @return \OCA\User_LDAP\User\OfflineUser[]
85 85
 	 */
86 86
 	public function getUsers() {
87
-		if(is_array($this->deletedUsers)) {
87
+		if (is_array($this->deletedUsers)) {
88 88
 			return $this->deletedUsers;
89 89
 		}
90 90
 		return $this->fetchDeletedUsers();
@@ -95,10 +95,10 @@  discard block
 block discarded – undo
95 95
 	 * @return bool
96 96
 	 */
97 97
 	public function hasUsers() {
98
-		if($this->deletedUsers === false) {
98
+		if ($this->deletedUsers === false) {
99 99
 			$this->fetchDeletedUsers();
100 100
 		}
101
-		if(is_array($this->deletedUsers) && count($this->deletedUsers) > 0) {
101
+		if (is_array($this->deletedUsers) && count($this->deletedUsers) > 0) {
102 102
 			return true;
103 103
 		}
104 104
 		return false;
Please login to merge, or discard this patch.
apps/user_ldap/lib/User/IUserTools.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -30,13 +30,13 @@
 block discarded – undo
30 30
  * defines methods that are required by User class for LDAP interaction
31 31
  */
32 32
 interface IUserTools {
33
-	public function getConnection();
33
+    public function getConnection();
34 34
 
35
-	public function readAttribute($dn, $attr, $filter = 'objectClass=*');
35
+    public function readAttribute($dn, $attr, $filter = 'objectClass=*');
36 36
 
37
-	public function stringResemblesDN($string);
37
+    public function stringResemblesDN($string);
38 38
 
39
-	public function dn2username($dn, $ldapname = null);
39
+    public function dn2username($dn, $ldapname = null);
40 40
 
41
-	public function username2dn($name);
41
+    public function username2dn($name);
42 42
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/User/OfflineUser.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -179,14 +179,14 @@  discard block
 block discarded – undo
179 179
 	 * reads the user details
180 180
 	 */
181 181
 	protected function fetchDetails() {
182
-		$properties = array (
182
+		$properties = array(
183 183
 			'displayName' => 'user_ldap',
184 184
 			'uid'         => 'user_ldap',
185 185
 			'homePath'    => 'user_ldap',
186 186
 			'email'       => 'settings',
187 187
 			'lastLogin'   => 'login'
188 188
 		);
189
-		foreach($properties as $property => $app) {
189
+		foreach ($properties as $property => $app) {
190 190
 			$this->$property = $this->config->getUserValue($this->ocName, $app, $property, '');
191 191
 		}
192 192
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 		', 1);
210 210
 		$query->execute(array($this->ocName));
211 211
 		$sResult = $query->fetchColumn(0);
212
-		if(intval($sResult) === 1) {
212
+		if (intval($sResult) === 1) {
213 213
 			$this->hasActiveShares = true;
214 214
 			return;
215 215
 		}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		', 1);
222 222
 		$query->execute(array($this->ocName));
223 223
 		$sResult = $query->fetchColumn(0);
224
-		if(intval($sResult) === 1) {
224
+		if (intval($sResult) === 1) {
225 225
 			$this->hasActiveShares = true;
226 226
 			return;
227 227
 		}
Please login to merge, or discard this patch.
Indentation   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -29,205 +29,205 @@
 block discarded – undo
29 29
 use OCP\IDBConnection;
30 30
 
31 31
 class OfflineUser {
32
-	/**
33
-	 * @var string $ocName
34
-	 */
35
-	protected $ocName;
36
-	/**
37
-	 * @var string $dn
38
-	 */
39
-	protected $dn;
40
-	/**
41
-	 * @var string $uid the UID as provided by LDAP
42
-	 */
43
-	protected $uid;
44
-	/**
45
-	 * @var string $displayName
46
-	 */
47
-	protected $displayName;
48
-	/**
49
-	 * @var string $homePath
50
-	 */
51
-	protected $homePath;
52
-	/**
53
-	 * @var string $lastLogin the timestamp of the last login
54
-	 */
55
-	protected $lastLogin;
56
-	/**
57
-	 * @var string $email
58
-	 */
59
-	protected $email;
60
-	/**
61
-	 * @var bool $hasActiveShares
62
-	 */
63
-	protected $hasActiveShares;
64
-	/**
65
-	 * @var IConfig $config
66
-	 */
67
-	protected $config;
68
-	/**
69
-	 * @var IDBConnection $db
70
-	 */
71
-	protected $db;
72
-	/**
73
-	 * @var \OCA\User_LDAP\Mapping\UserMapping
74
-	 */
75
-	protected $mapping;
76
-
77
-	/**
78
-	 * @param string $ocName
79
-	 * @param IConfig $config
80
-	 * @param IDBConnection $db
81
-	 * @param \OCA\User_LDAP\Mapping\UserMapping $mapping
82
-	 */
83
-	public function __construct($ocName, IConfig $config, IDBConnection $db, UserMapping $mapping) {
84
-		$this->ocName = $ocName;
85
-		$this->config = $config;
86
-		$this->db = $db;
87
-		$this->mapping = $mapping;
88
-		$this->fetchDetails();
89
-	}
90
-
91
-	/**
92
-	 * remove the Delete-flag from the user.
93
-	 */
94
-	public function unmark() {
95
-		$this->config->setUserValue($this->ocName, 'user_ldap', 'isDeleted', '0');
96
-	}
97
-
98
-	/**
99
-	 * exports the user details in an assoc array
100
-	 * @return array
101
-	 */
102
-	public function export() {
103
-		$data = array();
104
-		$data['ocName'] = $this->getOCName();
105
-		$data['dn'] = $this->getDN();
106
-		$data['uid'] = $this->getUID();
107
-		$data['displayName'] = $this->getDisplayName();
108
-		$data['homePath'] = $this->getHomePath();
109
-		$data['lastLogin'] = $this->getLastLogin();
110
-		$data['email'] = $this->getEmail();
111
-		$data['hasActiveShares'] = $this->getHasActiveShares();
112
-
113
-		return $data;
114
-	}
115
-
116
-	/**
117
-	 * getter for Nextcloud internal name
118
-	 * @return string
119
-	 */
120
-	public function getOCName() {
121
-		return $this->ocName;
122
-	}
123
-
124
-	/**
125
-	 * getter for LDAP uid
126
-	 * @return string
127
-	 */
128
-	public function getUID() {
129
-		return $this->uid;
130
-	}
131
-
132
-	/**
133
-	 * getter for LDAP DN
134
-	 * @return string
135
-	 */
136
-	public function getDN() {
137
-		return $this->dn;
138
-	}
139
-
140
-	/**
141
-	 * getter for display name
142
-	 * @return string
143
-	 */
144
-	public function getDisplayName() {
145
-		return $this->displayName;
146
-	}
147
-
148
-	/**
149
-	 * getter for email
150
-	 * @return string
151
-	 */
152
-	public function getEmail() {
153
-		return $this->email;
154
-	}
155
-
156
-	/**
157
-	 * getter for home directory path
158
-	 * @return string
159
-	 */
160
-	public function getHomePath() {
161
-		return $this->homePath;
162
-	}
163
-
164
-	/**
165
-	 * getter for the last login timestamp
166
-	 * @return int
167
-	 */
168
-	public function getLastLogin() {
169
-		return intval($this->lastLogin);
170
-	}
171
-
172
-	/**
173
-	 * getter for having active shares
174
-	 * @return bool
175
-	 */
176
-	public function getHasActiveShares() {
177
-		return $this->hasActiveShares;
178
-	}
179
-
180
-	/**
181
-	 * reads the user details
182
-	 */
183
-	protected function fetchDetails() {
184
-		$properties = array (
185
-			'displayName' => 'user_ldap',
186
-			'uid'         => 'user_ldap',
187
-			'homePath'    => 'user_ldap',
188
-			'email'       => 'settings',
189
-			'lastLogin'   => 'login'
190
-		);
191
-		foreach($properties as $property => $app) {
192
-			$this->$property = $this->config->getUserValue($this->ocName, $app, $property, '');
193
-		}
194
-
195
-		$dn = $this->mapping->getDNByName($this->ocName);
196
-		$this->dn = ($dn !== false) ? $dn : '';
197
-
198
-		$this->determineShares();
199
-	}
200
-
201
-
202
-	/**
203
-	 * finds out whether the user has active shares. The result is stored in
204
-	 * $this->hasActiveShares
205
-	 */
206
-	protected function determineShares() {
207
-		$query = $this->db->prepare('
32
+    /**
33
+     * @var string $ocName
34
+     */
35
+    protected $ocName;
36
+    /**
37
+     * @var string $dn
38
+     */
39
+    protected $dn;
40
+    /**
41
+     * @var string $uid the UID as provided by LDAP
42
+     */
43
+    protected $uid;
44
+    /**
45
+     * @var string $displayName
46
+     */
47
+    protected $displayName;
48
+    /**
49
+     * @var string $homePath
50
+     */
51
+    protected $homePath;
52
+    /**
53
+     * @var string $lastLogin the timestamp of the last login
54
+     */
55
+    protected $lastLogin;
56
+    /**
57
+     * @var string $email
58
+     */
59
+    protected $email;
60
+    /**
61
+     * @var bool $hasActiveShares
62
+     */
63
+    protected $hasActiveShares;
64
+    /**
65
+     * @var IConfig $config
66
+     */
67
+    protected $config;
68
+    /**
69
+     * @var IDBConnection $db
70
+     */
71
+    protected $db;
72
+    /**
73
+     * @var \OCA\User_LDAP\Mapping\UserMapping
74
+     */
75
+    protected $mapping;
76
+
77
+    /**
78
+     * @param string $ocName
79
+     * @param IConfig $config
80
+     * @param IDBConnection $db
81
+     * @param \OCA\User_LDAP\Mapping\UserMapping $mapping
82
+     */
83
+    public function __construct($ocName, IConfig $config, IDBConnection $db, UserMapping $mapping) {
84
+        $this->ocName = $ocName;
85
+        $this->config = $config;
86
+        $this->db = $db;
87
+        $this->mapping = $mapping;
88
+        $this->fetchDetails();
89
+    }
90
+
91
+    /**
92
+     * remove the Delete-flag from the user.
93
+     */
94
+    public function unmark() {
95
+        $this->config->setUserValue($this->ocName, 'user_ldap', 'isDeleted', '0');
96
+    }
97
+
98
+    /**
99
+     * exports the user details in an assoc array
100
+     * @return array
101
+     */
102
+    public function export() {
103
+        $data = array();
104
+        $data['ocName'] = $this->getOCName();
105
+        $data['dn'] = $this->getDN();
106
+        $data['uid'] = $this->getUID();
107
+        $data['displayName'] = $this->getDisplayName();
108
+        $data['homePath'] = $this->getHomePath();
109
+        $data['lastLogin'] = $this->getLastLogin();
110
+        $data['email'] = $this->getEmail();
111
+        $data['hasActiveShares'] = $this->getHasActiveShares();
112
+
113
+        return $data;
114
+    }
115
+
116
+    /**
117
+     * getter for Nextcloud internal name
118
+     * @return string
119
+     */
120
+    public function getOCName() {
121
+        return $this->ocName;
122
+    }
123
+
124
+    /**
125
+     * getter for LDAP uid
126
+     * @return string
127
+     */
128
+    public function getUID() {
129
+        return $this->uid;
130
+    }
131
+
132
+    /**
133
+     * getter for LDAP DN
134
+     * @return string
135
+     */
136
+    public function getDN() {
137
+        return $this->dn;
138
+    }
139
+
140
+    /**
141
+     * getter for display name
142
+     * @return string
143
+     */
144
+    public function getDisplayName() {
145
+        return $this->displayName;
146
+    }
147
+
148
+    /**
149
+     * getter for email
150
+     * @return string
151
+     */
152
+    public function getEmail() {
153
+        return $this->email;
154
+    }
155
+
156
+    /**
157
+     * getter for home directory path
158
+     * @return string
159
+     */
160
+    public function getHomePath() {
161
+        return $this->homePath;
162
+    }
163
+
164
+    /**
165
+     * getter for the last login timestamp
166
+     * @return int
167
+     */
168
+    public function getLastLogin() {
169
+        return intval($this->lastLogin);
170
+    }
171
+
172
+    /**
173
+     * getter for having active shares
174
+     * @return bool
175
+     */
176
+    public function getHasActiveShares() {
177
+        return $this->hasActiveShares;
178
+    }
179
+
180
+    /**
181
+     * reads the user details
182
+     */
183
+    protected function fetchDetails() {
184
+        $properties = array (
185
+            'displayName' => 'user_ldap',
186
+            'uid'         => 'user_ldap',
187
+            'homePath'    => 'user_ldap',
188
+            'email'       => 'settings',
189
+            'lastLogin'   => 'login'
190
+        );
191
+        foreach($properties as $property => $app) {
192
+            $this->$property = $this->config->getUserValue($this->ocName, $app, $property, '');
193
+        }
194
+
195
+        $dn = $this->mapping->getDNByName($this->ocName);
196
+        $this->dn = ($dn !== false) ? $dn : '';
197
+
198
+        $this->determineShares();
199
+    }
200
+
201
+
202
+    /**
203
+     * finds out whether the user has active shares. The result is stored in
204
+     * $this->hasActiveShares
205
+     */
206
+    protected function determineShares() {
207
+        $query = $this->db->prepare('
208 208
 			SELECT COUNT(`uid_owner`)
209 209
 			FROM `*PREFIX*share`
210 210
 			WHERE `uid_owner` = ?
211 211
 		', 1);
212
-		$query->execute(array($this->ocName));
213
-		$sResult = $query->fetchColumn(0);
214
-		if(intval($sResult) === 1) {
215
-			$this->hasActiveShares = true;
216
-			return;
217
-		}
218
-
219
-		$query = $this->db->prepare('
212
+        $query->execute(array($this->ocName));
213
+        $sResult = $query->fetchColumn(0);
214
+        if(intval($sResult) === 1) {
215
+            $this->hasActiveShares = true;
216
+            return;
217
+        }
218
+
219
+        $query = $this->db->prepare('
220 220
 			SELECT COUNT(`owner`)
221 221
 			FROM `*PREFIX*share_external`
222 222
 			WHERE `owner` = ?
223 223
 		', 1);
224
-		$query->execute(array($this->ocName));
225
-		$sResult = $query->fetchColumn(0);
226
-		if(intval($sResult) === 1) {
227
-			$this->hasActiveShares = true;
228
-			return;
229
-		}
230
-
231
-		$this->hasActiveShares = false;
232
-	}
224
+        $query->execute(array($this->ocName));
225
+        $sResult = $query->fetchColumn(0);
226
+        if(intval($sResult) === 1) {
227
+            $this->hasActiveShares = true;
228
+            return;
229
+        }
230
+
231
+        $this->hasActiveShares = false;
232
+    }
233 233
 }
Please login to merge, or discard this patch.
apps/user_ldap/lib/IUserLDAP.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -24,26 +24,26 @@
 block discarded – undo
24 24
 
25 25
 interface IUserLDAP {
26 26
 
27
-	//Functions used by LDAPProvider
27
+    //Functions used by LDAPProvider
28 28
 	
29
-	/**
30
-	 * Return access for LDAP interaction.
31
-	 * @param string $uid
32
-	 * @return Access instance of Access for LDAP interaction
33
-	 */
34
-	public function getLDAPAccess($uid);
29
+    /**
30
+     * Return access for LDAP interaction.
31
+     * @param string $uid
32
+     * @return Access instance of Access for LDAP interaction
33
+     */
34
+    public function getLDAPAccess($uid);
35 35
 	
36
-	/**
37
-	 * Return a new LDAP connection for the specified user.
38
-	 * @param string $uid
39
-	 * @return resource of the LDAP connection
40
-	 */
41
-	public function getNewLDAPConnection($uid);
36
+    /**
37
+     * Return a new LDAP connection for the specified user.
38
+     * @param string $uid
39
+     * @return resource of the LDAP connection
40
+     */
41
+    public function getNewLDAPConnection($uid);
42 42
 
43
-	/**
44
-	 * Return the username for the given LDAP DN, if available.
45
-	 * @param string $dn
46
-	 * @return string|false with the username
47
-	 */
48
-	public function dn2UserName($dn);
43
+    /**
44
+     * Return the username for the given LDAP DN, if available.
45
+     * @param string $dn
46
+     * @return string|false with the username
47
+     */
48
+    public function dn2UserName($dn);
49 49
 }
Please login to merge, or discard this patch.