@@ -28,13 +28,13 @@ |
||
| 28 | 28 | * @brief wraps around static ownCloud core methods |
| 29 | 29 | */ |
| 30 | 30 | class LogWrapper { |
| 31 | - protected $app = 'user_ldap'; |
|
| 31 | + protected $app = 'user_ldap'; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @brief states whether the filesystem was loaded |
|
| 35 | - * @return bool |
|
| 36 | - */ |
|
| 37 | - public function log($msg, $level) { |
|
| 38 | - \OCP\Util::writeLog($this->app, $msg, $level); |
|
| 39 | - } |
|
| 33 | + /** |
|
| 34 | + * @brief states whether the filesystem was loaded |
|
| 35 | + * @return bool |
|
| 36 | + */ |
|
| 37 | + public function log($msg, $level) { |
|
| 38 | + \OCP\Util::writeLog($this->app, $msg, $level); |
|
| 39 | + } |
|
| 40 | 40 | } |
@@ -28,32 +28,32 @@ |
||
| 28 | 28 | use OCA\User_LDAP\Mapping\UserMapping; |
| 29 | 29 | |
| 30 | 30 | class LDAPProviderFactory implements ILDAPProviderFactory { |
| 31 | - /** |
|
| 32 | - * Server container |
|
| 33 | - * |
|
| 34 | - * @var IServerContainer |
|
| 35 | - */ |
|
| 36 | - private $serverContainer; |
|
| 31 | + /** |
|
| 32 | + * Server container |
|
| 33 | + * |
|
| 34 | + * @var IServerContainer |
|
| 35 | + */ |
|
| 36 | + private $serverContainer; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Constructor for the LDAP provider factory |
|
| 40 | - * |
|
| 41 | - * @param IServerContainer $serverContainer server container |
|
| 42 | - */ |
|
| 43 | - public function __construct(IServerContainer $serverContainer) { |
|
| 44 | - $this->serverContainer = $serverContainer; |
|
| 45 | - } |
|
| 38 | + /** |
|
| 39 | + * Constructor for the LDAP provider factory |
|
| 40 | + * |
|
| 41 | + * @param IServerContainer $serverContainer server container |
|
| 42 | + */ |
|
| 43 | + public function __construct(IServerContainer $serverContainer) { |
|
| 44 | + $this->serverContainer = $serverContainer; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * creates and returns an instance of the ILDAPProvider |
|
| 49 | - * |
|
| 50 | - * @return OCP\LDAP\ILDAPProvider |
|
| 51 | - */ |
|
| 52 | - public function getLDAPProvider() { |
|
| 53 | - $dbConnection = $this->serverContainer->getDatabaseConnection(); |
|
| 54 | - $userMapping = new UserMapping($dbConnection); |
|
| 55 | - return new LDAPProvider($this->serverContainer, new Helper($this->serverContainer->getConfig()), |
|
| 56 | - new DeletedUsersIndex($this->serverContainer->getConfig(), |
|
| 57 | - $dbConnection, $userMapping)); |
|
| 58 | - } |
|
| 47 | + /** |
|
| 48 | + * creates and returns an instance of the ILDAPProvider |
|
| 49 | + * |
|
| 50 | + * @return OCP\LDAP\ILDAPProvider |
|
| 51 | + */ |
|
| 52 | + public function getLDAPProvider() { |
|
| 53 | + $dbConnection = $this->serverContainer->getDatabaseConnection(); |
|
| 54 | + $userMapping = new UserMapping($dbConnection); |
|
| 55 | + return new LDAPProvider($this->serverContainer, new Helper($this->serverContainer->getConfig()), |
|
| 56 | + new DeletedUsersIndex($this->serverContainer->getConfig(), |
|
| 57 | + $dbConnection, $userMapping)); |
|
| 58 | + } |
|
| 59 | 59 | } |
@@ -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 | ]); |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | $application->registerRoutes($this, [ |
| 42 | 42 | 'ocs' => [ |
| 43 | 43 | ['name' => 'ConfigAPI#create', 'url' => '/api/v1/config', 'verb' => 'POST'], |
| 44 | - ['name' => 'ConfigAPI#show', 'url' => '/api/v1/config/{configID}', 'verb' => 'GET'], |
|
| 44 | + ['name' => 'ConfigAPI#show', 'url' => '/api/v1/config/{configID}', 'verb' => 'GET'], |
|
| 45 | 45 | ['name' => 'ConfigAPI#modify', 'url' => '/api/v1/config/{configID}', 'verb' => 'PUT'], |
| 46 | 46 | ['name' => 'ConfigAPI#delete', 'url' => '/api/v1/config/{configID}', 'verb' => 'DELETE'], |
| 47 | 47 | ] |
@@ -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()); |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | * |
| 23 | 23 | */ |
| 24 | 24 | $state = OCP\Config::getSystemValue('ldapIgnoreNamingRules', 'doSet'); |
| 25 | -if($state === 'doSet') { |
|
| 25 | +if ($state === 'doSet') { |
|
| 26 | 26 | OCP\Config::setSystemValue('ldapIgnoreNamingRules', false); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -32,44 +32,44 @@ |
||
| 32 | 32 | $ldapWrapper = new OCA\User_LDAP\LDAP(); |
| 33 | 33 | $ocConfig = \OC::$server->getConfig(); |
| 34 | 34 | if(count($configPrefixes) === 1) { |
| 35 | - $dbc = \OC::$server->getDatabaseConnection(); |
|
| 36 | - $userManager = new OCA\User_LDAP\User\Manager($ocConfig, |
|
| 37 | - new OCA\User_LDAP\FilesystemHelper(), |
|
| 38 | - new OCA\User_LDAP\LogWrapper(), |
|
| 39 | - \OC::$server->getAvatarManager(), |
|
| 40 | - new \OCP\Image(), |
|
| 41 | - $dbc, |
|
| 42 | - \OC::$server->getUserManager() |
|
| 43 | - ); |
|
| 44 | - $connector = new OCA\User_LDAP\Connection($ldapWrapper, $configPrefixes[0]); |
|
| 45 | - $ldapAccess = new OCA\User_LDAP\Access($connector, $ldapWrapper, $userManager, $helper); |
|
| 35 | + $dbc = \OC::$server->getDatabaseConnection(); |
|
| 36 | + $userManager = new OCA\User_LDAP\User\Manager($ocConfig, |
|
| 37 | + new OCA\User_LDAP\FilesystemHelper(), |
|
| 38 | + new OCA\User_LDAP\LogWrapper(), |
|
| 39 | + \OC::$server->getAvatarManager(), |
|
| 40 | + new \OCP\Image(), |
|
| 41 | + $dbc, |
|
| 42 | + \OC::$server->getUserManager() |
|
| 43 | + ); |
|
| 44 | + $connector = new OCA\User_LDAP\Connection($ldapWrapper, $configPrefixes[0]); |
|
| 45 | + $ldapAccess = new OCA\User_LDAP\Access($connector, $ldapWrapper, $userManager, $helper); |
|
| 46 | 46 | |
| 47 | - $ldapAccess->setUserMapper(new OCA\User_LDAP\Mapping\UserMapping($dbc)); |
|
| 48 | - $ldapAccess->setGroupMapper(new OCA\User_LDAP\Mapping\GroupMapping($dbc)); |
|
| 49 | - $userBackend = new OCA\User_LDAP\User_LDAP($ldapAccess, $ocConfig); |
|
| 50 | - $groupBackend = new \OCA\User_LDAP\Group_LDAP($ldapAccess); |
|
| 47 | + $ldapAccess->setUserMapper(new OCA\User_LDAP\Mapping\UserMapping($dbc)); |
|
| 48 | + $ldapAccess->setGroupMapper(new OCA\User_LDAP\Mapping\GroupMapping($dbc)); |
|
| 49 | + $userBackend = new OCA\User_LDAP\User_LDAP($ldapAccess, $ocConfig); |
|
| 50 | + $groupBackend = new \OCA\User_LDAP\Group_LDAP($ldapAccess); |
|
| 51 | 51 | } else if(count($configPrefixes) > 1) { |
| 52 | - $userBackend = new OCA\User_LDAP\User_Proxy( |
|
| 53 | - $configPrefixes, $ldapWrapper, $ocConfig |
|
| 54 | - ); |
|
| 55 | - $groupBackend = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper); |
|
| 52 | + $userBackend = new OCA\User_LDAP\User_Proxy( |
|
| 53 | + $configPrefixes, $ldapWrapper, $ocConfig |
|
| 54 | + ); |
|
| 55 | + $groupBackend = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | if(count($configPrefixes) > 0) { |
| 59 | - // register user backend |
|
| 60 | - OC_User::useBackend($userBackend); |
|
| 61 | - OC_Group::useBackend($groupBackend); |
|
| 59 | + // register user backend |
|
| 60 | + OC_User::useBackend($userBackend); |
|
| 61 | + OC_Group::useBackend($groupBackend); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | \OCP\Util::connectHook( |
| 65 | - '\OCA\Files_Sharing\API\Server2Server', |
|
| 66 | - 'preLoginNameUsedAsUserName', |
|
| 67 | - '\OCA\User_LDAP\Helper', |
|
| 68 | - 'loginName2UserName' |
|
| 65 | + '\OCA\Files_Sharing\API\Server2Server', |
|
| 66 | + 'preLoginNameUsedAsUserName', |
|
| 67 | + '\OCA\User_LDAP\Helper', |
|
| 68 | + 'loginName2UserName' |
|
| 69 | 69 | ); |
| 70 | 70 | |
| 71 | 71 | if(OCP\App::isEnabled('user_webdavauth')) { |
| 72 | - OCP\Util::writeLog('user_ldap', |
|
| 73 | - 'user_ldap and user_webdavauth are incompatible. You may experience unexpected behaviour', |
|
| 74 | - OCP\Util::WARN); |
|
| 72 | + OCP\Util::writeLog('user_ldap', |
|
| 73 | + 'user_ldap and user_webdavauth are incompatible. You may experience unexpected behaviour', |
|
| 74 | + OCP\Util::WARN); |
|
| 75 | 75 | } |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $configPrefixes = $helper->getServerConfigurationPrefixes(true); |
| 32 | 32 | $ldapWrapper = new OCA\User_LDAP\LDAP(); |
| 33 | 33 | $ocConfig = \OC::$server->getConfig(); |
| 34 | -if(count($configPrefixes) === 1) { |
|
| 34 | +if (count($configPrefixes) === 1) { |
|
| 35 | 35 | $dbc = \OC::$server->getDatabaseConnection(); |
| 36 | 36 | $userManager = new OCA\User_LDAP\User\Manager($ocConfig, |
| 37 | 37 | new OCA\User_LDAP\FilesystemHelper(), |
@@ -48,14 +48,14 @@ discard block |
||
| 48 | 48 | $ldapAccess->setGroupMapper(new OCA\User_LDAP\Mapping\GroupMapping($dbc)); |
| 49 | 49 | $userBackend = new OCA\User_LDAP\User_LDAP($ldapAccess, $ocConfig); |
| 50 | 50 | $groupBackend = new \OCA\User_LDAP\Group_LDAP($ldapAccess); |
| 51 | -} else if(count($configPrefixes) > 1) { |
|
| 51 | +} else if (count($configPrefixes) > 1) { |
|
| 52 | 52 | $userBackend = new OCA\User_LDAP\User_Proxy( |
| 53 | 53 | $configPrefixes, $ldapWrapper, $ocConfig |
| 54 | 54 | ); |
| 55 | - $groupBackend = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper); |
|
| 55 | + $groupBackend = new OCA\User_LDAP\Group_Proxy($configPrefixes, $ldapWrapper); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | -if(count($configPrefixes) > 0) { |
|
| 58 | +if (count($configPrefixes) > 0) { |
|
| 59 | 59 | // register user backend |
| 60 | 60 | OC_User::useBackend($userBackend); |
| 61 | 61 | OC_Group::useBackend($groupBackend); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | 'loginName2UserName' |
| 69 | 69 | ); |
| 70 | 70 | |
| 71 | -if(OCP\App::isEnabled('user_webdavauth')) { |
|
| 71 | +if (OCP\App::isEnabled('user_webdavauth')) { |
|
| 72 | 72 | OCP\Util::writeLog('user_ldap', |
| 73 | 73 | 'user_ldap and user_webdavauth are incompatible. You may experience unexpected behaviour', |
| 74 | 74 | OCP\Util::WARN); |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | <div id="emptycontent" class="hidden"> |
| 8 | 8 | <div class="icon-external"></div> |
| 9 | 9 | <h2><?php p($l->t('No external storage configured')); ?></h2> |
| 10 | - <p><a href="<?php p(link_to('', 'index.php/settings/personal#files_external' )); ?>"><?php p($l->t('You can add external storages in the personal settings')); ?></a></p> |
|
| 10 | + <p><a href="<?php p(link_to('', 'index.php/settings/personal#files_external')); ?>"><?php p($l->t('You can add external storages in the personal settings')); ?></a></p> |
|
| 11 | 11 | </div> |
| 12 | 12 | |
| 13 | 13 | <input type="hidden" name="dir" value="" id="dir"> |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | <tr> |
| 18 | 18 | <th id='headerName' class="hidden column-name"> |
| 19 | 19 | <div id="headerName-container"> |
| 20 | - <a class="name sort columntitle" data-sort="name"><span><?php p($l->t( 'Name' )); ?></span><span class="sort-indicator"></span></a> |
|
| 20 | + <a class="name sort columntitle" data-sort="name"><span><?php p($l->t('Name')); ?></span><span class="sort-indicator"></span></a> |
|
| 21 | 21 | </div> |
| 22 | 22 | </th> |
| 23 | 23 | <th id="headerBackend" class="hidden column-backend"> |
@@ -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()); ?>" /> |
@@ -41,44 +41,44 @@ |
||
| 41 | 41 | $is_optional = $parameter->isFlagSet(DefinitionParameter::FLAG_OPTIONAL); |
| 42 | 42 | |
| 43 | 43 | switch ($parameter->getType()) { |
| 44 | - case DefinitionParameter::VALUE_PASSWORD: ?> |
|
| 45 | - <?php if ($is_optional) { $classes[] = 'optional'; } ?> |
|
| 46 | - <input type="password" |
|
| 44 | + case DefinitionParameter::VALUE_PASSWORD: ?> |
|
| 45 | + <?php if ($is_optional) { $classes[] = 'optional'; } ?> |
|
| 46 | + <input type="password" |
|
| 47 | 47 | <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
| 48 | - data-parameter="<?php p($parameter->getName()); ?>" |
|
| 48 | + data-parameter="<?php p($parameter->getName()); ?>" |
|
| 49 | 49 | value="<?php p($value); ?>" |
| 50 | 50 | placeholder="<?php p($placeholder); ?>" |
| 51 | 51 | /> |
| 52 | 52 | <?php |
| 53 | - break; |
|
| 54 | - case DefinitionParameter::VALUE_BOOLEAN: ?> |
|
| 55 | - <?php $checkboxId = uniqid("checkbox_"); ?> |
|
| 53 | + break; |
|
| 54 | + case DefinitionParameter::VALUE_BOOLEAN: ?> |
|
| 55 | + <?php $checkboxId = uniqid("checkbox_"); ?> |
|
| 56 | 56 | <div> |
| 57 | 57 | <label> |
| 58 | 58 | <input type="checkbox" |
| 59 | 59 | id="<?php p($checkboxId); ?>" |
| 60 | 60 | <?php if (!empty($classes)): ?> class="checkbox <?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
| 61 | - data-parameter="<?php p($parameter->getName()); ?>" |
|
| 61 | + data-parameter="<?php p($parameter->getName()); ?>" |
|
| 62 | 62 | <?php if ($value === true): ?> checked="checked"<?php endif; ?> |
| 63 | - /> |
|
| 63 | + /> |
|
| 64 | 64 | <?php p($placeholder); ?> |
| 65 | 65 | </label> |
| 66 | 66 | </div> |
| 67 | 67 | <?php |
| 68 | - break; |
|
| 69 | - case DefinitionParameter::VALUE_HIDDEN: ?> |
|
| 70 | - <input type="hidden" |
|
| 68 | + break; |
|
| 69 | + case DefinitionParameter::VALUE_HIDDEN: ?> |
|
| 70 | + <input type="hidden" |
|
| 71 | 71 | <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
| 72 | - data-parameter="<?php p($parameter->getName()); ?>" |
|
| 72 | + data-parameter="<?php p($parameter->getName()); ?>" |
|
| 73 | 73 | value="<?php p($value); ?>" |
| 74 | 74 | /> |
| 75 | 75 | <?php |
| 76 | - break; |
|
| 77 | - default: ?> |
|
| 78 | - <?php if ($is_optional) { $classes[] = 'optional'; } ?> |
|
| 79 | - <input type="text" |
|
| 76 | + break; |
|
| 77 | + default: ?> |
|
| 78 | + <?php if ($is_optional) { $classes[] = 'optional'; } ?> |
|
| 79 | + <input type="text" |
|
| 80 | 80 | <?php if (!empty($classes)): ?> class="<?php p(implode(' ', $classes)); ?>"<?php endif; ?> |
| 81 | - data-parameter="<?php p($parameter->getName()); ?>" |
|
| 81 | + data-parameter="<?php p($parameter->getName()); ?>" |
|
| 82 | 82 | value="<?php p($value); ?>" |
| 83 | 83 | placeholder="<?php p($placeholder); ?>" |
| 84 | 84 | /> |
@@ -87,9 +87,9 @@ |
||
| 87 | 87 | } |
| 88 | 88 | ?> |
| 89 | 89 | |
| 90 | -<form data-can-create="<?php echo $canCreateMounts?'true':'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>"> |
|
| 90 | +<form data-can-create="<?php echo $canCreateMounts ? 'true' : 'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled'] ? 'true' : 'false'; ?>"> |
|
| 91 | 91 | <h2><?php p($l->t('External storage')); ?></h2> |
| 92 | - <?php if (isset($_['dependencies']) and ($_['dependencies']<>'') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?> |
|
| 92 | + <?php if (isset($_['dependencies']) and ($_['dependencies'] <> '') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?> |
|
| 93 | 93 | <table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'> |
| 94 | 94 | <thead> |
| 95 | 95 | <tr> |
@@ -89,7 +89,10 @@ discard block |
||
| 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'; ?>"> |
| 91 | 91 | <h2><?php p($l->t('External storage')); ?></h2> |
| 92 | - <?php if (isset($_['dependencies']) and ($_['dependencies']<>'') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?> |
|
| 92 | + <?php if (isset($_['dependencies']) and ($_['dependencies']<>'') and $canCreateMounts) { |
|
| 93 | + print_unescaped(''.$_['dependencies'].''); |
|
| 94 | +} |
|
| 95 | +?> |
|
| 93 | 96 | <table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'> |
| 94 | 97 | <thead> |
| 95 | 98 | <tr> |
@@ -98,7 +101,10 @@ discard block |
||
| 98 | 101 | <th><?php p($l->t('External storage')); ?></th> |
| 99 | 102 | <th><?php p($l->t('Authentication')); ?></th> |
| 100 | 103 | <th><?php p($l->t('Configuration')); ?></th> |
| 101 | - <?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN) print_unescaped('<th>'.$l->t('Available for').'</th>'); ?> |
|
| 104 | + <?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN) { |
|
| 105 | + print_unescaped('<th>'.$l->t('Available for').'</th>'); |
|
| 106 | +} |
|
| 107 | +?> |
|
| 102 | 108 | <th> </th> |
| 103 | 109 | <th> </th> |
| 104 | 110 | </tr> |
@@ -130,7 +136,10 @@ discard block |
||
| 130 | 136 | }); |
| 131 | 137 | ?> |
| 132 | 138 | <?php foreach ($sortedBackends as $backend): ?> |
| 133 | - <?php if ($backend->getDeprecateTo()) continue; // ignore deprecated backends ?> |
|
| 139 | + <?php if ($backend->getDeprecateTo()) { |
|
| 140 | + continue; |
|
| 141 | +} |
|
| 142 | +// ignore deprecated backends ?> |
|
| 134 | 143 | <option value="<?php p($backend->getIdentifier()); ?>"><?php p($backend->getText()); ?></option> |
| 135 | 144 | <?php endforeach; ?> |
| 136 | 145 | </select> |
@@ -163,7 +172,10 @@ discard block |
||
| 163 | 172 | |
| 164 | 173 | <?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN): ?> |
| 165 | 174 | <input type="checkbox" name="allowUserMounting" id="allowUserMounting" class="checkbox" |
| 166 | - value="1" <?php if ($_['allowUserMounting'] == 'yes') print_unescaped(' checked="checked"'); ?> /> |
|
| 175 | + value="1" <?php if ($_['allowUserMounting'] == 'yes') { |
|
| 176 | + print_unescaped(' checked="checked"'); |
|
| 177 | +} |
|
| 178 | +?> /> |
|
| 167 | 179 | <label for="allowUserMounting"><?php p($l->t('Allow users to mount external storage')); ?></label> <span id="userMountingMsg" class="msg"></span> |
| 168 | 180 | |
| 169 | 181 | <p id="userMountingBackends"<?php if ($_['allowUserMounting'] != 'yes'): ?> class="hidden"<?php endif; ?>> |
@@ -176,8 +188,14 @@ discard block |
||
| 176 | 188 | <?php $i = 0; foreach ($userBackends as $backend): ?> |
| 177 | 189 | <?php if ($deprecateTo = $backend->getDeprecateTo()): ?> |
| 178 | 190 | <input type="hidden" id="allowUserMountingBackends<?php p($i); ?>" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" data-deprecate-to="<?php p($deprecateTo->getIdentifier()); ?>" /> |
| 179 | - <?php else: ?> |
|
| 180 | - <input type="checkbox" id="allowUserMountingBackends<?php p($i); ?>" class="checkbox" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" <?php if ($backend->isVisibleFor(BackendService::VISIBILITY_PERSONAL)) print_unescaped(' checked="checked"'); ?> /> |
|
| 191 | + <?php else { |
|
| 192 | + : ?> |
|
| 193 | + <input type="checkbox" id="allowUserMountingBackends<?php p($i); |
|
| 194 | +} |
|
| 195 | +?>" class="checkbox" name="allowUserMountingBackends[]" value="<?php p($backend->getIdentifier()); ?>" <?php if ($backend->isVisibleFor(BackendService::VISIBILITY_PERSONAL)) { |
|
| 196 | + print_unescaped(' checked="checked"'); |
|
| 197 | +} |
|
| 198 | +?> /> |
|
| 181 | 199 | <label for="allowUserMountingBackends<?php p($i); ?>"><?php p($backend->getText()); ?></label> <br /> |
| 182 | 200 | <?php endif; ?> |
| 183 | 201 | <?php $i++; ?> |