@@ -34,8 +34,8 @@ |
||
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 | } |
@@ -38,12 +38,12 @@ |
||
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 |
@@ -29,12 +29,12 @@ |
||
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 | } |
@@ -29,12 +29,12 @@ |
||
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 | } |
@@ -31,84 +31,84 @@ |
||
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 | } |
@@ -30,13 +30,13 @@ |
||
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 | } |
@@ -24,26 +24,26 @@ |
||
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 | } |
@@ -27,13 +27,13 @@ |
||
27 | 27 | |
28 | 28 | |
29 | 29 | abstract class BackendUtility { |
30 | - protected $access; |
|
30 | + protected $access; |
|
31 | 31 | |
32 | - /** |
|
33 | - * constructor, make sure the subclasses call this one! |
|
34 | - * @param Access $access an instance of Access for LDAP interaction |
|
35 | - */ |
|
36 | - public function __construct(Access $access) { |
|
37 | - $this->access = $access; |
|
38 | - } |
|
32 | + /** |
|
33 | + * constructor, make sure the subclasses call this one! |
|
34 | + * @param Access $access an instance of Access for LDAP interaction |
|
35 | + */ |
|
36 | + public function __construct(Access $access) { |
|
37 | + $this->access = $access; |
|
38 | + } |
|
39 | 39 | } |
@@ -28,52 +28,52 @@ |
||
28 | 28 | namespace OCA\User_LDAP; |
29 | 29 | |
30 | 30 | class WizardResult { |
31 | - protected $changes = array(); |
|
32 | - protected $options = array(); |
|
33 | - protected $markedChange = false; |
|
31 | + protected $changes = array(); |
|
32 | + protected $options = array(); |
|
33 | + protected $markedChange = false; |
|
34 | 34 | |
35 | - /** |
|
36 | - * @param string $key |
|
37 | - * @param mixed $value |
|
38 | - */ |
|
39 | - public function addChange($key, $value) { |
|
40 | - $this->changes[$key] = $value; |
|
41 | - } |
|
35 | + /** |
|
36 | + * @param string $key |
|
37 | + * @param mixed $value |
|
38 | + */ |
|
39 | + public function addChange($key, $value) { |
|
40 | + $this->changes[$key] = $value; |
|
41 | + } |
|
42 | 42 | |
43 | - /** |
|
44 | - * |
|
45 | - */ |
|
46 | - public function markChange() { |
|
47 | - $this->markedChange = true; |
|
48 | - } |
|
43 | + /** |
|
44 | + * |
|
45 | + */ |
|
46 | + public function markChange() { |
|
47 | + $this->markedChange = true; |
|
48 | + } |
|
49 | 49 | |
50 | - /** |
|
51 | - * @param string $key |
|
52 | - * @param array|string $values |
|
53 | - */ |
|
54 | - public function addOptions($key, $values) { |
|
55 | - if(!is_array($values)) { |
|
56 | - $values = array($values); |
|
57 | - } |
|
58 | - $this->options[$key] = $values; |
|
59 | - } |
|
50 | + /** |
|
51 | + * @param string $key |
|
52 | + * @param array|string $values |
|
53 | + */ |
|
54 | + public function addOptions($key, $values) { |
|
55 | + if(!is_array($values)) { |
|
56 | + $values = array($values); |
|
57 | + } |
|
58 | + $this->options[$key] = $values; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @return bool |
|
63 | - */ |
|
64 | - public function hasChanges() { |
|
65 | - return (count($this->changes) > 0 || $this->markedChange); |
|
66 | - } |
|
61 | + /** |
|
62 | + * @return bool |
|
63 | + */ |
|
64 | + public function hasChanges() { |
|
65 | + return (count($this->changes) > 0 || $this->markedChange); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * @return array |
|
70 | - */ |
|
71 | - public function getResultArray() { |
|
72 | - $result = array(); |
|
73 | - $result['changes'] = $this->changes; |
|
74 | - if(count($this->options) > 0) { |
|
75 | - $result['options'] = $this->options; |
|
76 | - } |
|
77 | - return $result; |
|
78 | - } |
|
68 | + /** |
|
69 | + * @return array |
|
70 | + */ |
|
71 | + public function getResultArray() { |
|
72 | + $result = array(); |
|
73 | + $result['changes'] = $this->changes; |
|
74 | + if(count($this->options) > 0) { |
|
75 | + $result['options'] = $this->options; |
|
76 | + } |
|
77 | + return $result; |
|
78 | + } |
|
79 | 79 | } |