@@ -29,192 +29,192 @@ |
||
29 | 29 | |
30 | 30 | interface ILDAPWrapper { |
31 | 31 | |
32 | - //LDAP functions in use |
|
33 | - |
|
34 | - /** |
|
35 | - * Bind to LDAP directory |
|
36 | - * @param resource $link LDAP link resource |
|
37 | - * @param string $dn an RDN to log in with |
|
38 | - * @param string $password the password |
|
39 | - * @return bool true on success, false otherwise |
|
40 | - * |
|
41 | - * with $dn and $password as null a anonymous bind is attempted. |
|
42 | - */ |
|
43 | - public function bind($link, $dn, $password); |
|
44 | - |
|
45 | - /** |
|
46 | - * connect to an LDAP server |
|
47 | - * @param string $host The host to connect to |
|
48 | - * @param string $port The port to connect to |
|
49 | - * @return mixed a link resource on success, otherwise false |
|
50 | - */ |
|
51 | - public function connect($host, $port); |
|
52 | - |
|
53 | - /** |
|
54 | - * Send LDAP pagination control |
|
55 | - * @param resource $link LDAP link resource |
|
56 | - * @param int $pageSize number of results per page |
|
57 | - * @param bool $isCritical Indicates whether the pagination is critical of not. |
|
58 | - * @param string $cookie structure sent by LDAP server |
|
59 | - * @return bool true on success, false otherwise |
|
60 | - */ |
|
61 | - public function controlPagedResult($link, $pageSize, $isCritical, $cookie); |
|
62 | - |
|
63 | - /** |
|
64 | - * Retrieve the LDAP pagination cookie |
|
65 | - * @param resource $link LDAP link resource |
|
66 | - * @param resource $result LDAP result resource |
|
67 | - * @param string $cookie structure sent by LDAP server |
|
68 | - * @return bool true on success, false otherwise |
|
69 | - * |
|
70 | - * Corresponds to ldap_control_paged_result_response |
|
71 | - */ |
|
72 | - public function controlPagedResultResponse($link, $result, &$cookie); |
|
73 | - |
|
74 | - /** |
|
75 | - * Count the number of entries in a search |
|
76 | - * @param resource $link LDAP link resource |
|
77 | - * @param resource $result LDAP result resource |
|
78 | - * @return int|false number of results on success, false otherwise |
|
79 | - */ |
|
80 | - public function countEntries($link, $result); |
|
81 | - |
|
82 | - /** |
|
83 | - * Return the LDAP error number of the last LDAP command |
|
84 | - * @param resource $link LDAP link resource |
|
85 | - * @return string error message as string |
|
86 | - */ |
|
87 | - public function errno($link); |
|
88 | - |
|
89 | - /** |
|
90 | - * Return the LDAP error message of the last LDAP command |
|
91 | - * @param resource $link LDAP link resource |
|
92 | - * @return int error code as integer |
|
93 | - */ |
|
94 | - public function error($link); |
|
95 | - |
|
96 | - /** |
|
97 | - * Splits DN into its component parts |
|
98 | - * @param string $dn |
|
99 | - * @param int @withAttrib |
|
100 | - * @return array|false |
|
101 | - * @link http://www.php.net/manual/en/function.ldap-explode-dn.php |
|
102 | - */ |
|
103 | - public function explodeDN($dn, $withAttrib); |
|
104 | - |
|
105 | - /** |
|
106 | - * Return first result id |
|
107 | - * @param resource $link LDAP link resource |
|
108 | - * @param resource $result LDAP result resource |
|
109 | - * @return Resource an LDAP search result resource |
|
110 | - * */ |
|
111 | - public function firstEntry($link, $result); |
|
112 | - |
|
113 | - /** |
|
114 | - * Get attributes from a search result entry |
|
115 | - * @param resource $link LDAP link resource |
|
116 | - * @param resource $result LDAP result resource |
|
117 | - * @return array containing the results, false on error |
|
118 | - * */ |
|
119 | - public function getAttributes($link, $result); |
|
120 | - |
|
121 | - /** |
|
122 | - * Get the DN of a result entry |
|
123 | - * @param resource $link LDAP link resource |
|
124 | - * @param resource $result LDAP result resource |
|
125 | - * @return string containing the DN, false on error |
|
126 | - */ |
|
127 | - public function getDN($link, $result); |
|
128 | - |
|
129 | - /** |
|
130 | - * Get all result entries |
|
131 | - * @param resource $link LDAP link resource |
|
132 | - * @param resource $result LDAP result resource |
|
133 | - * @return array containing the results, false on error |
|
134 | - */ |
|
135 | - public function getEntries($link, $result); |
|
136 | - |
|
137 | - /** |
|
138 | - * Return next result id |
|
139 | - * @param resource $link LDAP link resource |
|
140 | - * @param resource $result LDAP entry result resource |
|
141 | - * @return resource an LDAP search result resource |
|
142 | - * */ |
|
143 | - public function nextEntry($link, $result); |
|
144 | - |
|
145 | - /** |
|
146 | - * Read an entry |
|
147 | - * @param resource $link LDAP link resource |
|
148 | - * @param array $baseDN The DN of the entry to read from |
|
149 | - * @param string $filter An LDAP filter |
|
150 | - * @param array $attr array of the attributes to read |
|
151 | - * @return resource an LDAP search result resource |
|
152 | - */ |
|
153 | - public function read($link, $baseDN, $filter, $attr); |
|
154 | - |
|
155 | - /** |
|
156 | - * Search LDAP tree |
|
157 | - * @param resource $link LDAP link resource |
|
158 | - * @param string $baseDN The DN of the entry to read from |
|
159 | - * @param string $filter An LDAP filter |
|
160 | - * @param array $attr array of the attributes to read |
|
161 | - * @param int $attrsOnly optional, 1 if only attribute types shall be returned |
|
162 | - * @param int $limit optional, limits the result entries |
|
163 | - * @return resource|false an LDAP search result resource, false on error |
|
164 | - */ |
|
165 | - public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0); |
|
32 | + //LDAP functions in use |
|
33 | + |
|
34 | + /** |
|
35 | + * Bind to LDAP directory |
|
36 | + * @param resource $link LDAP link resource |
|
37 | + * @param string $dn an RDN to log in with |
|
38 | + * @param string $password the password |
|
39 | + * @return bool true on success, false otherwise |
|
40 | + * |
|
41 | + * with $dn and $password as null a anonymous bind is attempted. |
|
42 | + */ |
|
43 | + public function bind($link, $dn, $password); |
|
44 | + |
|
45 | + /** |
|
46 | + * connect to an LDAP server |
|
47 | + * @param string $host The host to connect to |
|
48 | + * @param string $port The port to connect to |
|
49 | + * @return mixed a link resource on success, otherwise false |
|
50 | + */ |
|
51 | + public function connect($host, $port); |
|
52 | + |
|
53 | + /** |
|
54 | + * Send LDAP pagination control |
|
55 | + * @param resource $link LDAP link resource |
|
56 | + * @param int $pageSize number of results per page |
|
57 | + * @param bool $isCritical Indicates whether the pagination is critical of not. |
|
58 | + * @param string $cookie structure sent by LDAP server |
|
59 | + * @return bool true on success, false otherwise |
|
60 | + */ |
|
61 | + public function controlPagedResult($link, $pageSize, $isCritical, $cookie); |
|
62 | + |
|
63 | + /** |
|
64 | + * Retrieve the LDAP pagination cookie |
|
65 | + * @param resource $link LDAP link resource |
|
66 | + * @param resource $result LDAP result resource |
|
67 | + * @param string $cookie structure sent by LDAP server |
|
68 | + * @return bool true on success, false otherwise |
|
69 | + * |
|
70 | + * Corresponds to ldap_control_paged_result_response |
|
71 | + */ |
|
72 | + public function controlPagedResultResponse($link, $result, &$cookie); |
|
73 | + |
|
74 | + /** |
|
75 | + * Count the number of entries in a search |
|
76 | + * @param resource $link LDAP link resource |
|
77 | + * @param resource $result LDAP result resource |
|
78 | + * @return int|false number of results on success, false otherwise |
|
79 | + */ |
|
80 | + public function countEntries($link, $result); |
|
81 | + |
|
82 | + /** |
|
83 | + * Return the LDAP error number of the last LDAP command |
|
84 | + * @param resource $link LDAP link resource |
|
85 | + * @return string error message as string |
|
86 | + */ |
|
87 | + public function errno($link); |
|
88 | + |
|
89 | + /** |
|
90 | + * Return the LDAP error message of the last LDAP command |
|
91 | + * @param resource $link LDAP link resource |
|
92 | + * @return int error code as integer |
|
93 | + */ |
|
94 | + public function error($link); |
|
95 | + |
|
96 | + /** |
|
97 | + * Splits DN into its component parts |
|
98 | + * @param string $dn |
|
99 | + * @param int @withAttrib |
|
100 | + * @return array|false |
|
101 | + * @link http://www.php.net/manual/en/function.ldap-explode-dn.php |
|
102 | + */ |
|
103 | + public function explodeDN($dn, $withAttrib); |
|
104 | + |
|
105 | + /** |
|
106 | + * Return first result id |
|
107 | + * @param resource $link LDAP link resource |
|
108 | + * @param resource $result LDAP result resource |
|
109 | + * @return Resource an LDAP search result resource |
|
110 | + * */ |
|
111 | + public function firstEntry($link, $result); |
|
112 | + |
|
113 | + /** |
|
114 | + * Get attributes from a search result entry |
|
115 | + * @param resource $link LDAP link resource |
|
116 | + * @param resource $result LDAP result resource |
|
117 | + * @return array containing the results, false on error |
|
118 | + * */ |
|
119 | + public function getAttributes($link, $result); |
|
120 | + |
|
121 | + /** |
|
122 | + * Get the DN of a result entry |
|
123 | + * @param resource $link LDAP link resource |
|
124 | + * @param resource $result LDAP result resource |
|
125 | + * @return string containing the DN, false on error |
|
126 | + */ |
|
127 | + public function getDN($link, $result); |
|
128 | + |
|
129 | + /** |
|
130 | + * Get all result entries |
|
131 | + * @param resource $link LDAP link resource |
|
132 | + * @param resource $result LDAP result resource |
|
133 | + * @return array containing the results, false on error |
|
134 | + */ |
|
135 | + public function getEntries($link, $result); |
|
136 | + |
|
137 | + /** |
|
138 | + * Return next result id |
|
139 | + * @param resource $link LDAP link resource |
|
140 | + * @param resource $result LDAP entry result resource |
|
141 | + * @return resource an LDAP search result resource |
|
142 | + * */ |
|
143 | + public function nextEntry($link, $result); |
|
144 | + |
|
145 | + /** |
|
146 | + * Read an entry |
|
147 | + * @param resource $link LDAP link resource |
|
148 | + * @param array $baseDN The DN of the entry to read from |
|
149 | + * @param string $filter An LDAP filter |
|
150 | + * @param array $attr array of the attributes to read |
|
151 | + * @return resource an LDAP search result resource |
|
152 | + */ |
|
153 | + public function read($link, $baseDN, $filter, $attr); |
|
154 | + |
|
155 | + /** |
|
156 | + * Search LDAP tree |
|
157 | + * @param resource $link LDAP link resource |
|
158 | + * @param string $baseDN The DN of the entry to read from |
|
159 | + * @param string $filter An LDAP filter |
|
160 | + * @param array $attr array of the attributes to read |
|
161 | + * @param int $attrsOnly optional, 1 if only attribute types shall be returned |
|
162 | + * @param int $limit optional, limits the result entries |
|
163 | + * @return resource|false an LDAP search result resource, false on error |
|
164 | + */ |
|
165 | + public function search($link, $baseDN, $filter, $attr, $attrsOnly = 0, $limit = 0); |
|
166 | 166 | |
167 | - /** |
|
168 | - * Replace the value of a userPassword by $password |
|
169 | - * @param resource $link LDAP link resource |
|
170 | - * @param string $userDN the DN of the user whose password is to be replaced |
|
171 | - * @param string $password the new value for the userPassword |
|
172 | - * @return bool true on success, false otherwise |
|
173 | - */ |
|
174 | - public function modReplace($link, $userDN, $password); |
|
175 | - |
|
176 | - /** |
|
177 | - * Sets the value of the specified option to be $value |
|
178 | - * @param resource $link LDAP link resource |
|
179 | - * @param string $option a defined LDAP Server option |
|
180 | - * @param int $value the new value for the option |
|
181 | - * @return bool true on success, false otherwise |
|
182 | - */ |
|
183 | - public function setOption($link, $option, $value); |
|
184 | - |
|
185 | - /** |
|
186 | - * establish Start TLS |
|
187 | - * @param resource $link LDAP link resource |
|
188 | - * @return bool true on success, false otherwise |
|
189 | - */ |
|
190 | - public function startTls($link); |
|
191 | - |
|
192 | - /** |
|
193 | - * Unbind from LDAP directory |
|
194 | - * @param resource $link LDAP link resource |
|
195 | - * @return bool true on success, false otherwise |
|
196 | - */ |
|
197 | - public function unbind($link); |
|
198 | - |
|
199 | - //additional required methods in ownCloud |
|
200 | - |
|
201 | - /** |
|
202 | - * Checks whether the server supports LDAP |
|
203 | - * @return bool true if it the case, false otherwise |
|
204 | - * */ |
|
205 | - public function areLDAPFunctionsAvailable(); |
|
206 | - |
|
207 | - /** |
|
208 | - * Checks whether PHP supports LDAP Paged Results |
|
209 | - * @return bool true if it the case, false otherwise |
|
210 | - * */ |
|
211 | - public function hasPagedResultSupport(); |
|
212 | - |
|
213 | - /** |
|
214 | - * Checks whether the submitted parameter is a resource |
|
215 | - * @param resource $resource the resource variable to check |
|
216 | - * @return bool true if it is a resource, false otherwise |
|
217 | - */ |
|
218 | - public function isResource($resource); |
|
167 | + /** |
|
168 | + * Replace the value of a userPassword by $password |
|
169 | + * @param resource $link LDAP link resource |
|
170 | + * @param string $userDN the DN of the user whose password is to be replaced |
|
171 | + * @param string $password the new value for the userPassword |
|
172 | + * @return bool true on success, false otherwise |
|
173 | + */ |
|
174 | + public function modReplace($link, $userDN, $password); |
|
175 | + |
|
176 | + /** |
|
177 | + * Sets the value of the specified option to be $value |
|
178 | + * @param resource $link LDAP link resource |
|
179 | + * @param string $option a defined LDAP Server option |
|
180 | + * @param int $value the new value for the option |
|
181 | + * @return bool true on success, false otherwise |
|
182 | + */ |
|
183 | + public function setOption($link, $option, $value); |
|
184 | + |
|
185 | + /** |
|
186 | + * establish Start TLS |
|
187 | + * @param resource $link LDAP link resource |
|
188 | + * @return bool true on success, false otherwise |
|
189 | + */ |
|
190 | + public function startTls($link); |
|
191 | + |
|
192 | + /** |
|
193 | + * Unbind from LDAP directory |
|
194 | + * @param resource $link LDAP link resource |
|
195 | + * @return bool true on success, false otherwise |
|
196 | + */ |
|
197 | + public function unbind($link); |
|
198 | + |
|
199 | + //additional required methods in ownCloud |
|
200 | + |
|
201 | + /** |
|
202 | + * Checks whether the server supports LDAP |
|
203 | + * @return bool true if it the case, false otherwise |
|
204 | + * */ |
|
205 | + public function areLDAPFunctionsAvailable(); |
|
206 | + |
|
207 | + /** |
|
208 | + * Checks whether PHP supports LDAP Paged Results |
|
209 | + * @return bool true if it the case, false otherwise |
|
210 | + * */ |
|
211 | + public function hasPagedResultSupport(); |
|
212 | + |
|
213 | + /** |
|
214 | + * Checks whether the submitted parameter is a resource |
|
215 | + * @param resource $resource the resource variable to check |
|
216 | + * @return bool true if it is a resource, false otherwise |
|
217 | + */ |
|
218 | + public function isResource($resource); |
|
219 | 219 | |
220 | 220 | } |
@@ -23,26 +23,26 @@ |
||
23 | 23 | |
24 | 24 | /** @var $this \OCP\Route\IRouter */ |
25 | 25 | $this->create('user_ldap_ajax_clearMappings', 'ajax/clearMappings.php') |
26 | - ->actionInclude('user_ldap/ajax/clearMappings.php'); |
|
26 | + ->actionInclude('user_ldap/ajax/clearMappings.php'); |
|
27 | 27 | $this->create('user_ldap_ajax_deleteConfiguration', 'ajax/deleteConfiguration.php') |
28 | - ->actionInclude('user_ldap/ajax/deleteConfiguration.php'); |
|
28 | + ->actionInclude('user_ldap/ajax/deleteConfiguration.php'); |
|
29 | 29 | $this->create('user_ldap_ajax_getConfiguration', 'ajax/getConfiguration.php') |
30 | - ->actionInclude('user_ldap/ajax/getConfiguration.php'); |
|
30 | + ->actionInclude('user_ldap/ajax/getConfiguration.php'); |
|
31 | 31 | $this->create('user_ldap_ajax_getNewServerConfigPrefix', 'ajax/getNewServerConfigPrefix.php') |
32 | - ->actionInclude('user_ldap/ajax/getNewServerConfigPrefix.php'); |
|
32 | + ->actionInclude('user_ldap/ajax/getNewServerConfigPrefix.php'); |
|
33 | 33 | $this->create('user_ldap_ajax_setConfiguration', 'ajax/setConfiguration.php') |
34 | - ->actionInclude('user_ldap/ajax/setConfiguration.php'); |
|
34 | + ->actionInclude('user_ldap/ajax/setConfiguration.php'); |
|
35 | 35 | $this->create('user_ldap_ajax_testConfiguration', 'ajax/testConfiguration.php') |
36 | - ->actionInclude('user_ldap/ajax/testConfiguration.php'); |
|
36 | + ->actionInclude('user_ldap/ajax/testConfiguration.php'); |
|
37 | 37 | $this->create('user_ldap_ajax_wizard', 'ajax/wizard.php') |
38 | - ->actionInclude('user_ldap/ajax/wizard.php'); |
|
38 | + ->actionInclude('user_ldap/ajax/wizard.php'); |
|
39 | 39 | |
40 | 40 | $application = new \OCP\AppFramework\App('user_ldap'); |
41 | 41 | $application->registerRoutes($this, [ |
42 | - 'ocs' => [ |
|
43 | - ['name' => 'ConfigAPI#create', 'url' => '/api/v1/config', 'verb' => 'POST'], |
|
44 | - ['name' => 'ConfigAPI#show', 'url' => '/api/v1/config/{configID}', 'verb' => 'GET'], |
|
45 | - ['name' => 'ConfigAPI#modify', 'url' => '/api/v1/config/{configID}', 'verb' => 'PUT'], |
|
46 | - ['name' => 'ConfigAPI#delete', 'url' => '/api/v1/config/{configID}', 'verb' => 'DELETE'], |
|
47 | - ] |
|
42 | + 'ocs' => [ |
|
43 | + ['name' => 'ConfigAPI#create', 'url' => '/api/v1/config', 'verb' => 'POST'], |
|
44 | + ['name' => 'ConfigAPI#show', 'url' => '/api/v1/config/{configID}', 'verb' => 'GET'], |
|
45 | + ['name' => 'ConfigAPI#modify', 'url' => '/api/v1/config/{configID}', 'verb' => 'PUT'], |
|
46 | + ['name' => 'ConfigAPI#delete', 'url' => '/api/v1/config/{configID}', 'verb' => 'DELETE'], |
|
47 | + ] |
|
48 | 48 | ]); |
@@ -33,12 +33,12 @@ discard block |
||
33 | 33 | $helper = new Helper(\OC::$server->getConfig()); |
34 | 34 | $ocConfig = \OC::$server->getConfig(); |
35 | 35 | $uBackend = new User_Proxy( |
36 | - $helper->getServerConfigurationPrefixes(true), |
|
37 | - new LDAP(), |
|
38 | - $ocConfig |
|
36 | + $helper->getServerConfigurationPrefixes(true), |
|
37 | + new LDAP(), |
|
38 | + $ocConfig |
|
39 | 39 | ); |
40 | 40 | $deletedUsersIndex = new DeletedUsersIndex( |
41 | - $ocConfig, $dbConnection, $userMapping |
|
41 | + $ocConfig, $dbConnection, $userMapping |
|
42 | 42 | ); |
43 | 43 | |
44 | 44 | $application->add(new OCA\User_LDAP\Command\ShowConfig($helper)); |
@@ -48,8 +48,8 @@ discard block |
||
48 | 48 | $application->add(new OCA\User_LDAP\Command\DeleteConfig($helper)); |
49 | 49 | $application->add(new OCA\User_LDAP\Command\Search($ocConfig)); |
50 | 50 | $application->add(new OCA\User_LDAP\Command\ShowRemnants( |
51 | - $deletedUsersIndex, \OC::$server->getDateTimeFormatter()) |
|
51 | + $deletedUsersIndex, \OC::$server->getDateTimeFormatter()) |
|
52 | 52 | ); |
53 | 53 | $application->add(new OCA\User_LDAP\Command\CheckUser( |
54 | - $uBackend, $helper, $deletedUsersIndex, $userMapping) |
|
54 | + $uBackend, $helper, $deletedUsersIndex, $userMapping) |
|
55 | 55 | ); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | */ |
24 | 24 | $state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'doSet'); |
25 | 25 | if($state === 'doSet') { |
26 | - OCP\Config::setSystemValue('ldapIgnoreNamingRules', false); |
|
26 | + OCP\Config::setSystemValue('ldapIgnoreNamingRules', false); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig()); |
@@ -1,47 +1,47 @@ discard block |
||
1 | 1 | <?php |
2 | - use \OCA\Files_External\Lib\Backend\Backend; |
|
3 | - use \OCA\Files_External\Lib\Auth\AuthMechanism; |
|
4 | - use \OCA\Files_External\Lib\DefinitionParameter; |
|
5 | - use \OCA\Files_External\Service\BackendService; |
|
2 | + use \OCA\Files_External\Lib\Backend\Backend; |
|
3 | + use \OCA\Files_External\Lib\Auth\AuthMechanism; |
|
4 | + use \OCA\Files_External\Lib\DefinitionParameter; |
|
5 | + use \OCA\Files_External\Service\BackendService; |
|
6 | 6 | |
7 | - $canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || $_['allowUserMounting']; |
|
7 | + $canCreateMounts = $_['visibilityType'] === BackendService::VISIBILITY_ADMIN || $_['allowUserMounting']; |
|
8 | 8 | |
9 | - $l->t("Enable encryption"); |
|
10 | - $l->t("Enable previews"); |
|
11 | - $l->t("Enable sharing"); |
|
12 | - $l->t("Check for changes"); |
|
13 | - $l->t("Never"); |
|
14 | - $l->t("Once every direct access"); |
|
9 | + $l->t("Enable encryption"); |
|
10 | + $l->t("Enable previews"); |
|
11 | + $l->t("Enable sharing"); |
|
12 | + $l->t("Check for changes"); |
|
13 | + $l->t("Never"); |
|
14 | + $l->t("Once every direct access"); |
|
15 | 15 | |
16 | - script('files_external', 'settings'); |
|
17 | - style('files_external', 'settings'); |
|
16 | + script('files_external', 'settings'); |
|
17 | + style('files_external', 'settings'); |
|
18 | 18 | |
19 | - // load custom JS |
|
20 | - foreach ($_['backends'] as $backend) { |
|
21 | - /** @var Backend $backend */ |
|
22 | - $scripts = $backend->getCustomJs(); |
|
23 | - foreach ($scripts as $script) { |
|
24 | - script('files_external', $script); |
|
25 | - } |
|
26 | - } |
|
27 | - foreach ($_['authMechanisms'] as $authMechanism) { |
|
28 | - /** @var AuthMechanism $authMechanism */ |
|
29 | - $scripts = $authMechanism->getCustomJs(); |
|
30 | - foreach ($scripts as $script) { |
|
31 | - script('files_external', $script); |
|
32 | - } |
|
33 | - } |
|
19 | + // load custom JS |
|
20 | + foreach ($_['backends'] as $backend) { |
|
21 | + /** @var Backend $backend */ |
|
22 | + $scripts = $backend->getCustomJs(); |
|
23 | + foreach ($scripts as $script) { |
|
24 | + script('files_external', $script); |
|
25 | + } |
|
26 | + } |
|
27 | + foreach ($_['authMechanisms'] as $authMechanism) { |
|
28 | + /** @var AuthMechanism $authMechanism */ |
|
29 | + $scripts = $authMechanism->getCustomJs(); |
|
30 | + foreach ($scripts as $script) { |
|
31 | + script('files_external', $script); |
|
32 | + } |
|
33 | + } |
|
34 | 34 | |
35 | - function writeParameterInput($parameter, $options, $classes = []) { |
|
36 | - $value = ''; |
|
37 | - if (isset($options[$parameter->getName()])) { |
|
38 | - $value = $options[$parameter->getName()]; |
|
39 | - } |
|
40 | - $placeholder = $parameter->getText(); |
|
41 | - $is_optional = $parameter->isFlagSet(DefinitionParameter::FLAG_OPTIONAL); |
|
35 | + function writeParameterInput($parameter, $options, $classes = []) { |
|
36 | + $value = ''; |
|
37 | + if (isset($options[$parameter->getName()])) { |
|
38 | + $value = $options[$parameter->getName()]; |
|
39 | + } |
|
40 | + $placeholder = $parameter->getText(); |
|
41 | + $is_optional = $parameter->isFlagSet(DefinitionParameter::FLAG_OPTIONAL); |
|
42 | 42 | |
43 | - switch ($parameter->getType()) { |
|
44 | - case DefinitionParameter::VALUE_PASSWORD: ?> |
|
43 | + switch ($parameter->getType()) { |
|
44 | + case DefinitionParameter::VALUE_PASSWORD: ?> |
|
45 | 45 | <?php if ($is_optional) { $classes[] = 'optional'; } ?> |
46 | 46 | <input type="password" |
47 | 47 | <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | placeholder="<?php p($placeholder); ?>" |
51 | 51 | /> |
52 | 52 | <?php |
53 | - break; |
|
54 | - case DefinitionParameter::VALUE_BOOLEAN: ?> |
|
53 | + break; |
|
54 | + case DefinitionParameter::VALUE_BOOLEAN: ?> |
|
55 | 55 | <?php $checkboxId = uniqid("checkbox_"); ?> |
56 | 56 | <div> |
57 | 57 | <label> |
@@ -65,16 +65,16 @@ discard block |
||
65 | 65 | </label> |
66 | 66 | </div> |
67 | 67 | <?php |
68 | - break; |
|
69 | - case DefinitionParameter::VALUE_HIDDEN: ?> |
|
68 | + break; |
|
69 | + case DefinitionParameter::VALUE_HIDDEN: ?> |
|
70 | 70 | <input type="hidden" |
71 | 71 | <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
72 | 72 | data-parameter="<?php p($parameter->getName()); ?>" |
73 | 73 | value="<?php p($value); ?>" |
74 | 74 | /> |
75 | 75 | <?php |
76 | - break; |
|
77 | - default: ?> |
|
76 | + break; |
|
77 | + default: ?> |
|
78 | 78 | <?php if ($is_optional) { $classes[] = 'optional'; } ?> |
79 | 79 | <input type="text" |
80 | 80 | <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | placeholder="<?php p($placeholder); ?>" |
84 | 84 | /> |
85 | 85 | <?php |
86 | - } |
|
87 | - } |
|
86 | + } |
|
87 | + } |
|
88 | 88 | ?> |
89 | 89 | |
90 | 90 | <form data-can-create="<?php echo $canCreateMounts?'true':'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>"> |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | <?php p($l->t('Add storage')); ?> |
123 | 123 | </option> |
124 | 124 | <?php |
125 | - $sortedBackends = array_filter($_['backends'], function($backend) use ($_) { |
|
126 | - return $backend->isVisibleFor($_['visibilityType']); |
|
127 | - }); |
|
128 | - uasort($sortedBackends, function($a, $b) { |
|
129 | - return strcasecmp($a->getText(), $b->getText()); |
|
130 | - }); |
|
131 | - ?> |
|
125 | + $sortedBackends = array_filter($_['backends'], function($backend) use ($_) { |
|
126 | + return $backend->isVisibleFor($_['visibilityType']); |
|
127 | + }); |
|
128 | + uasort($sortedBackends, function($a, $b) { |
|
129 | + return strcasecmp($a->getText(), $b->getText()); |
|
130 | + }); |
|
131 | + ?> |
|
132 | 132 | <?php foreach ($sortedBackends as $backend): ?> |
133 | 133 | <?php if ($backend->getDeprecateTo()) continue; // ignore deprecated backends ?> |
134 | 134 | <option value="<?php p($backend->getIdentifier()); ?>"><?php p($backend->getText()); ?></option> |
@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | <p id="userMountingBackends"<?php if ($_['allowUserMounting'] != 'yes'): ?> class="hidden"<?php endif; ?>> |
170 | 170 | <?php p($l->t('Allow users to mount the following external storage')); ?><br /> |
171 | 171 | <?php |
172 | - $userBackends = array_filter($_['backends'], function($backend) { |
|
173 | - return $backend->isAllowedVisibleFor(BackendService::VISIBILITY_PERSONAL); |
|
174 | - }); |
|
175 | - ?> |
|
172 | + $userBackends = array_filter($_['backends'], function($backend) { |
|
173 | + return $backend->isAllowedVisibleFor(BackendService::VISIBILITY_PERSONAL); |
|
174 | + }); |
|
175 | + ?> |
|
176 | 176 | <?php $i = 0; foreach ($userBackends as $backend): ?> |
177 | 177 | <?php if ($deprecateTo = $backend->getDeprecateTo()): ?> |
178 | 178 | <input type="hidden" id="allowUserMountingBackends<?php p($i); ?>" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" data-deprecate-to="<?php p($deprecateTo->getIdentifier()); ?>" /> |
@@ -33,42 +33,42 @@ |
||
33 | 33 | |
34 | 34 | // FIXME: currently hard-coded to Dropbox OAuth |
35 | 35 | if (isset($_POST['app_key']) && isset($_POST['app_secret'])) { |
36 | - $oauth = new Dropbox_OAuth_Curl((string)$_POST['app_key'], (string)$_POST['app_secret']); |
|
37 | - if (isset($_POST['step'])) { |
|
38 | - switch ($_POST['step']) { |
|
39 | - case 1: |
|
40 | - try { |
|
41 | - if (isset($_POST['callback'])) { |
|
42 | - $callback = (string)$_POST['callback']; |
|
43 | - } else { |
|
44 | - $callback = null; |
|
45 | - } |
|
46 | - $token = $oauth->getRequestToken(); |
|
47 | - OCP\JSON::success(array('data' => array('url' => $oauth->getAuthorizeUrl($callback), |
|
48 | - 'request_token' => $token['token'], |
|
49 | - 'request_token_secret' => $token['token_secret']))); |
|
50 | - } catch (Exception $exception) { |
|
51 | - OCP\JSON::error(array('data' => array('message' => |
|
52 | - $l->t('Fetching request tokens failed. Verify that your app key and secret are correct.')) |
|
53 | - )); |
|
54 | - } |
|
55 | - break; |
|
56 | - case 2: |
|
57 | - if (isset($_POST['request_token']) && isset($_POST['request_token_secret'])) { |
|
58 | - try { |
|
59 | - $oauth->setToken((string)$_POST['request_token'], (string)$_POST['request_token_secret']); |
|
60 | - $token = $oauth->getAccessToken(); |
|
61 | - OCP\JSON::success(array('access_token' => $token['token'], |
|
62 | - 'access_token_secret' => $token['token_secret'])); |
|
63 | - } catch (Exception $exception) { |
|
64 | - OCP\JSON::error(array('data' => array('message' => |
|
65 | - $l->t('Fetching access tokens failed. Verify that your app key and secret are correct.')) |
|
66 | - )); |
|
67 | - } |
|
68 | - } |
|
69 | - break; |
|
70 | - } |
|
71 | - } |
|
36 | + $oauth = new Dropbox_OAuth_Curl((string)$_POST['app_key'], (string)$_POST['app_secret']); |
|
37 | + if (isset($_POST['step'])) { |
|
38 | + switch ($_POST['step']) { |
|
39 | + case 1: |
|
40 | + try { |
|
41 | + if (isset($_POST['callback'])) { |
|
42 | + $callback = (string)$_POST['callback']; |
|
43 | + } else { |
|
44 | + $callback = null; |
|
45 | + } |
|
46 | + $token = $oauth->getRequestToken(); |
|
47 | + OCP\JSON::success(array('data' => array('url' => $oauth->getAuthorizeUrl($callback), |
|
48 | + 'request_token' => $token['token'], |
|
49 | + 'request_token_secret' => $token['token_secret']))); |
|
50 | + } catch (Exception $exception) { |
|
51 | + OCP\JSON::error(array('data' => array('message' => |
|
52 | + $l->t('Fetching request tokens failed. Verify that your app key and secret are correct.')) |
|
53 | + )); |
|
54 | + } |
|
55 | + break; |
|
56 | + case 2: |
|
57 | + if (isset($_POST['request_token']) && isset($_POST['request_token_secret'])) { |
|
58 | + try { |
|
59 | + $oauth->setToken((string)$_POST['request_token'], (string)$_POST['request_token_secret']); |
|
60 | + $token = $oauth->getAccessToken(); |
|
61 | + OCP\JSON::success(array('access_token' => $token['token'], |
|
62 | + 'access_token_secret' => $token['token_secret'])); |
|
63 | + } catch (Exception $exception) { |
|
64 | + OCP\JSON::error(array('data' => array('message' => |
|
65 | + $l->t('Fetching access tokens failed. Verify that your app key and secret are correct.')) |
|
66 | + )); |
|
67 | + } |
|
68 | + } |
|
69 | + break; |
|
70 | + } |
|
71 | + } |
|
72 | 72 | } else { |
73 | - OCP\JSON::error(array('data' => array('message' => $l->t('Please provide a valid app key and secret.')))); |
|
73 | + OCP\JSON::error(array('data' => array('message' => $l->t('Please provide a valid app key and secret.')))); |
|
74 | 74 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | */ |
30 | 30 | set_include_path(get_include_path().PATH_SEPARATOR. |
31 | - \OC_App::getAppPath('files_external').'/3rdparty/google-api-php-client/src'); |
|
31 | + \OC_App::getAppPath('files_external').'/3rdparty/google-api-php-client/src'); |
|
32 | 32 | require_once 'Google/autoload.php'; |
33 | 33 | |
34 | 34 | OCP\JSON::checkAppEnabled('files_external'); |
@@ -38,37 +38,37 @@ discard block |
||
38 | 38 | |
39 | 39 | // FIXME: currently hard-coded to Google Drive |
40 | 40 | if (isset($_POST['client_id']) && isset($_POST['client_secret']) && isset($_POST['redirect'])) { |
41 | - $client = new Google_Client(); |
|
42 | - $client->setClientId((string)$_POST['client_id']); |
|
43 | - $client->setClientSecret((string)$_POST['client_secret']); |
|
44 | - $client->setRedirectUri((string)$_POST['redirect']); |
|
45 | - $client->setScopes(array('https://www.googleapis.com/auth/drive')); |
|
46 | - $client->setApprovalPrompt('force'); |
|
47 | - $client->setAccessType('offline'); |
|
48 | - if (isset($_POST['step'])) { |
|
49 | - $step = $_POST['step']; |
|
50 | - if ($step == 1) { |
|
51 | - try { |
|
52 | - $authUrl = $client->createAuthUrl(); |
|
53 | - OCP\JSON::success(array('data' => array( |
|
54 | - 'url' => $authUrl |
|
55 | - ))); |
|
56 | - } catch (Exception $exception) { |
|
57 | - OCP\JSON::error(array('data' => array( |
|
58 | - 'message' => $l->t('Step 1 failed. Exception: %s', array($exception->getMessage())) |
|
59 | - ))); |
|
60 | - } |
|
61 | - } else if ($step == 2 && isset($_POST['code'])) { |
|
62 | - try { |
|
63 | - $token = $client->authenticate((string)$_POST['code']); |
|
64 | - OCP\JSON::success(array('data' => array( |
|
65 | - 'token' => $token |
|
66 | - ))); |
|
67 | - } catch (Exception $exception) { |
|
68 | - OCP\JSON::error(array('data' => array( |
|
69 | - 'message' => $l->t('Step 2 failed. Exception: %s', array($exception->getMessage())) |
|
70 | - ))); |
|
71 | - } |
|
72 | - } |
|
73 | - } |
|
41 | + $client = new Google_Client(); |
|
42 | + $client->setClientId((string)$_POST['client_id']); |
|
43 | + $client->setClientSecret((string)$_POST['client_secret']); |
|
44 | + $client->setRedirectUri((string)$_POST['redirect']); |
|
45 | + $client->setScopes(array('https://www.googleapis.com/auth/drive')); |
|
46 | + $client->setApprovalPrompt('force'); |
|
47 | + $client->setAccessType('offline'); |
|
48 | + if (isset($_POST['step'])) { |
|
49 | + $step = $_POST['step']; |
|
50 | + if ($step == 1) { |
|
51 | + try { |
|
52 | + $authUrl = $client->createAuthUrl(); |
|
53 | + OCP\JSON::success(array('data' => array( |
|
54 | + 'url' => $authUrl |
|
55 | + ))); |
|
56 | + } catch (Exception $exception) { |
|
57 | + OCP\JSON::error(array('data' => array( |
|
58 | + 'message' => $l->t('Step 1 failed. Exception: %s', array($exception->getMessage())) |
|
59 | + ))); |
|
60 | + } |
|
61 | + } else if ($step == 2 && isset($_POST['code'])) { |
|
62 | + try { |
|
63 | + $token = $client->authenticate((string)$_POST['code']); |
|
64 | + OCP\JSON::success(array('data' => array( |
|
65 | + 'token' => $token |
|
66 | + ))); |
|
67 | + } catch (Exception $exception) { |
|
68 | + OCP\JSON::error(array('data' => array( |
|
69 | + 'message' => $l->t('Step 2 failed. Exception: %s', array($exception->getMessage())) |
|
70 | + ))); |
|
71 | + } |
|
72 | + } |
|
73 | + } |
|
74 | 74 | } |
@@ -30,23 +30,23 @@ |
||
30 | 30 | $limit = null; |
31 | 31 | $offset = null; |
32 | 32 | if (isset($_GET['pattern'])) { |
33 | - $pattern = (string)$_GET['pattern']; |
|
33 | + $pattern = (string)$_GET['pattern']; |
|
34 | 34 | } |
35 | 35 | if (isset($_GET['limit'])) { |
36 | - $limit = (int)$_GET['limit']; |
|
36 | + $limit = (int)$_GET['limit']; |
|
37 | 37 | } |
38 | 38 | if (isset($_GET['offset'])) { |
39 | - $offset = (int)$_GET['offset']; |
|
39 | + $offset = (int)$_GET['offset']; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | $groups = []; |
43 | 43 | foreach (\OC::$server->getGroupManager()->search($pattern, $limit, $offset) as $group) { |
44 | - $groups[$group->getGID()] = $group->getGID(); |
|
44 | + $groups[$group->getGID()] = $group->getGID(); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $users = []; |
48 | 48 | foreach (\OC::$server->getUserManager()->searchDisplayName($pattern, $limit, $offset) as $user) { |
49 | - $users[$user->getUID()] = $user->getDisplayName(); |
|
49 | + $users[$user->getUID()] = $user->getDisplayName(); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | $results = array('groups' => $groups, 'users' => $users); |
@@ -24,25 +24,25 @@ |
||
24 | 24 | namespace OCA\Files_External\Service; |
25 | 25 | |
26 | 26 | class ImportLegacyStoragesService extends LegacyStoragesService { |
27 | - private $data; |
|
27 | + private $data; |
|
28 | 28 | |
29 | - /** |
|
30 | - * @param BackendService $backendService |
|
31 | - */ |
|
32 | - public function __construct(BackendService $backendService) { |
|
33 | - $this->backendService = $backendService; |
|
34 | - } |
|
29 | + /** |
|
30 | + * @param BackendService $backendService |
|
31 | + */ |
|
32 | + public function __construct(BackendService $backendService) { |
|
33 | + $this->backendService = $backendService; |
|
34 | + } |
|
35 | 35 | |
36 | - public function setData($data) { |
|
37 | - $this->data = $data; |
|
38 | - } |
|
36 | + public function setData($data) { |
|
37 | + $this->data = $data; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * Read legacy config data |
|
42 | - * |
|
43 | - * @return array list of mount configs |
|
44 | - */ |
|
45 | - protected function readLegacyConfig() { |
|
46 | - return $this->data; |
|
47 | - } |
|
40 | + /** |
|
41 | + * Read legacy config data |
|
42 | + * |
|
43 | + * @return array list of mount configs |
|
44 | + */ |
|
45 | + protected function readLegacyConfig() { |
|
46 | + return $this->data; |
|
47 | + } |
|
48 | 48 | } |