@@ -22,11 +22,6 @@ |
||
22 | 22 | namespace OCA\DAV\Command; |
23 | 23 | |
24 | 24 | use OCA\DAV\CardDAV\CardDavBackend; |
25 | -use OCA\DAV\Connector\Sabre\Principal; |
|
26 | -use OCP\IConfig; |
|
27 | -use OCP\IDBConnection; |
|
28 | -use OCP\IGroupManager; |
|
29 | -use OCP\ILogger; |
|
30 | 25 | use OCP\IUserManager; |
31 | 26 | use Symfony\Component\Console\Command\Command; |
32 | 27 | use Symfony\Component\Console\Input\InputArgument; |
@@ -21,10 +21,8 @@ |
||
21 | 21 | namespace OCA\DAV\Command; |
22 | 22 | |
23 | 23 | use OCA\DAV\CardDAV\SyncService; |
24 | -use OCP\IUserManager; |
|
25 | 24 | use Symfony\Component\Console\Command\Command; |
26 | 25 | use Symfony\Component\Console\Helper\ProgressBar; |
27 | -use Symfony\Component\Console\Input\InputArgument; |
|
28 | 26 | use Symfony\Component\Console\Input\InputInterface; |
29 | 27 | use Symfony\Component\Console\Output\OutputInterface; |
30 | 28 |
@@ -22,7 +22,6 @@ |
||
22 | 22 | namespace OCA\DAV\CalDAV; |
23 | 23 | |
24 | 24 | use OCA\DAV\DAV\Sharing\IShareable; |
25 | -use Sabre\CalDAV\Backend\BackendInterface; |
|
26 | 25 | use Sabre\DAV\Exception\Forbidden; |
27 | 26 | use Sabre\DAV\PropPatch; |
28 | 27 |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | function getACL() { |
83 | - $acl = [ |
|
83 | + $acl = [ |
|
84 | 84 | [ |
85 | 85 | 'privilege' => '{DAV:}read', |
86 | 86 | 'principal' => $this->getOwner(), |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | ]; |
95 | 95 | } |
96 | 96 | if ($this->getOwner() !== parent::getOwner()) { |
97 | - $acl[] = [ |
|
97 | + $acl[] = [ |
|
98 | 98 | 'privilege' => '{DAV:}read', |
99 | 99 | 'principal' => parent::getOwner(), |
100 | 100 | 'protected' => true, |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | function delete() { |
128 | 128 | if (isset($this->calendarInfo['{http://owncloud.org/ns}owner-principal'])) { |
129 | - $principal = 'principal:' . parent::getOwner(); |
|
129 | + $principal = 'principal:'.parent::getOwner(); |
|
130 | 130 | $shares = $this->getShares(); |
131 | 131 | $shares = array_filter($shares, function($share) use ($principal){ |
132 | 132 | return $share['href'] === $principal; |
@@ -21,7 +21,6 @@ |
||
21 | 21 | namespace OCA\DAV\Connector\Sabre; |
22 | 22 | |
23 | 23 | use Sabre\Xml\XmlSerializable; |
24 | -use Sabre\Xml\Element; |
|
25 | 24 | use Sabre\Xml\Writer; |
26 | 25 | |
27 | 26 | /** |
@@ -66,7 +66,7 @@ |
||
66 | 66 | function xmlSerialize(Writer $writer) { |
67 | 67 | |
68 | 68 | foreach ($this->checksums as $checksum) { |
69 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum); |
|
69 | + $writer->writeElement('{'.self::NS_OWNCLOUD.'}checksum', $checksum); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | } |
@@ -23,14 +23,11 @@ |
||
23 | 23 | namespace OCA\DAV\Connector\Sabre; |
24 | 24 | |
25 | 25 | use Sabre\DAV\Exception\NotFound; |
26 | -use Sabre\DAV\IFile; |
|
27 | 26 | use Sabre\DAV\INode; |
28 | 27 | use \Sabre\DAV\PropFind; |
29 | 28 | use \Sabre\DAV\PropPatch; |
30 | -use Sabre\DAVACL\Exception\NeedPrivileges; |
|
31 | 29 | use \Sabre\HTTP\RequestInterface; |
32 | 30 | use \Sabre\HTTP\ResponseInterface; |
33 | -use Sabre\HTTP\URLUtil; |
|
34 | 31 | |
35 | 32 | /** |
36 | 33 | * Class DavAclPlugin is a wrapper around \Sabre\DAVACL\Plugin that returns 404 |
@@ -47,11 +47,11 @@ |
||
47 | 47 | |
48 | 48 | function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) { |
49 | 49 | $access = parent::checkPrivileges($uri, $privileges, $recursion, false); |
50 | - if($access === false) { |
|
50 | + if ($access === false) { |
|
51 | 51 | /** @var INode $node */ |
52 | 52 | $node = $this->server->tree->getNodeForPath($uri); |
53 | 53 | |
54 | - switch(get_class($node)) { |
|
54 | + switch (get_class($node)) { |
|
55 | 55 | case 'OCA\DAV\CardDAV\AddressBook': |
56 | 56 | $type = 'Addressbook'; |
57 | 57 | break; |
@@ -24,7 +24,6 @@ |
||
24 | 24 | use OCA\DAV\Connector\Sabre\Auth; |
25 | 25 | use OCA\DAV\DAV\Sharing\Xml\Invite; |
26 | 26 | use OCP\IRequest; |
27 | -use Sabre\DAV\Exception\BadRequest; |
|
28 | 27 | use Sabre\DAV\Exception\NotFound; |
29 | 28 | use Sabre\DAV\INode; |
30 | 29 | use Sabre\DAV\PropFind; |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | */ |
100 | 100 | function initialize(Server $server) { |
101 | 101 | $this->server = $server; |
102 | - $this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}share'] = 'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest'; |
|
103 | - $this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}invite'] = 'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite'; |
|
102 | + $this->server->xml->elementMap['{'.Plugin::NS_OWNCLOUD.'}share'] = 'OCA\\DAV\\DAV\\Sharing\\Xml\\ShareRequest'; |
|
103 | + $this->server->xml->elementMap['{'.Plugin::NS_OWNCLOUD.'}invite'] = 'OCA\\DAV\\DAV\\Sharing\\Xml\\Invite'; |
|
104 | 104 | |
105 | 105 | $this->server->on('method:POST', [$this, 'httpPost']); |
106 | - $this->server->on('propFind', [$this, 'propFind']); |
|
106 | + $this->server->on('propFind', [$this, 'propFind']); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | |
147 | 147 | // Dealing with the 'share' document, which modified invitees on a |
148 | 148 | // calendar. |
149 | - case '{' . self::NS_OWNCLOUD . '}share' : |
|
149 | + case '{'.self::NS_OWNCLOUD.'}share' : |
|
150 | 150 | |
151 | 151 | // We can only deal with IShareableCalendar objects |
152 | 152 | if (!$node instanceof IShareable) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | function propFind(PropFind $propFind, INode $node) { |
190 | 190 | if ($node instanceof IShareable) { |
191 | 191 | |
192 | - $propFind->handle('{' . Plugin::NS_OWNCLOUD . '}invite', function() use ($node) { |
|
192 | + $propFind->handle('{'.Plugin::NS_OWNCLOUD.'}invite', function() use ($node) { |
|
193 | 193 | return new Invite( |
194 | 194 | $node->getShares() |
195 | 195 | ); |
@@ -22,10 +22,6 @@ |
||
22 | 22 | namespace OCA\Dav\Migration; |
23 | 23 | |
24 | 24 | use OCP\IDBConnection; |
25 | -use Symfony\Component\Console\Command\Command; |
|
26 | -use Symfony\Component\Console\Input\InputArgument; |
|
27 | -use Symfony\Component\Console\Input\InputInterface; |
|
28 | -use Symfony\Component\Console\Output\OutputInterface; |
|
29 | 25 | |
30 | 26 | class AddressBookAdapter { |
31 | 27 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | ->where($query->expr()->eq('userid', $query->createNamedParameter($user))) |
64 | 64 | ->execute(); |
65 | 65 | |
66 | - while($row = $stmt->fetch()) { |
|
66 | + while ($row = $stmt->fetch()) { |
|
67 | 67 | $callBack($row); |
68 | 68 | } |
69 | 69 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | ->where($query->expr()->eq('addressbookid', $query->createNamedParameter($addressBookId))) |
85 | 85 | ->execute(); |
86 | 86 | |
87 | - while($row = $stmt->fetch()) { |
|
87 | + while ($row = $stmt->fetch()) { |
|
88 | 88 | $callBack($row); |
89 | 89 | } |
90 | 90 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $shares = $query->select('*')->from('share') |
99 | 99 | ->where($query->expr()->eq('item_source', $query->createNamedParameter($addressBookId))) |
100 | 100 | ->andWhere($query->expr()->eq('item_type', $query->expr()->literal('addressbook'))) |
101 | - ->andWhere($query->expr()->in('share_type', [ $query->expr()->literal(0), $query->expr()->literal(1)])) |
|
101 | + ->andWhere($query->expr()->in('share_type', [$query->expr()->literal(0), $query->expr()->literal(1)])) |
|
102 | 102 | ->execute() |
103 | 103 | ->fetchAll(); |
104 | 104 |
@@ -24,7 +24,6 @@ |
||
24 | 24 | namespace OCA\DAV; |
25 | 25 | |
26 | 26 | use OCA\DAV\CalDAV\Schedule\IMipPlugin; |
27 | -use OCA\DAV\Connector\FedAuth; |
|
28 | 27 | use OCA\DAV\Connector\Sabre\Auth; |
29 | 28 | use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin; |
30 | 29 | use OCA\DAV\Connector\Sabre\DavAclPlugin; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | // Some WebDAV clients do require Class 2 WebDAV support (locking), since |
111 | 111 | // we do not provide locking we emulate it using a fake locking plugin. |
112 | - if($request->isUserAgent([ |
|
112 | + if ($request->isUserAgent([ |
|
113 | 113 | '/WebDAVFS/', |
114 | 114 | '/Microsoft Office OneNote 2013/', |
115 | 115 | ])) { |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | } |
122 | 122 | |
123 | 123 | // wait with registering these until auth is handled and the filesystem is setup |
124 | - $this->server->on('beforeMethod', function () { |
|
124 | + $this->server->on('beforeMethod', function() { |
|
125 | 125 | // custom properties plugin must be the last one |
126 | 126 | $user = \OC::$server->getUserSession()->getUser(); |
127 | 127 | if (!is_null($user)) { |
@@ -32,7 +32,6 @@ |
||
32 | 32 | use OCA\Encryption\Crypto\Crypt; |
33 | 33 | use OCP\Encryption\Keys\IStorage; |
34 | 34 | use OCP\IConfig; |
35 | -use OCP\IDBConnection; |
|
36 | 35 | use OCP\ILogger; |
37 | 36 | use OCP\IUserSession; |
38 | 37 |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $this->recoveryKeyId = $this->config->getAppValue('encryption', |
129 | 129 | 'recoveryKeyId'); |
130 | 130 | if (empty($this->recoveryKeyId)) { |
131 | - $this->recoveryKeyId = 'recoveryKey_' . substr(md5(time()), 0, 8); |
|
131 | + $this->recoveryKeyId = 'recoveryKey_'.substr(md5(time()), 0, 8); |
|
132 | 132 | $this->config->setAppValue('encryption', |
133 | 133 | 'recoveryKeyId', |
134 | 134 | $this->recoveryKeyId); |
@@ -137,14 +137,14 @@ discard block |
||
137 | 137 | $this->publicShareKeyId = $this->config->getAppValue('encryption', |
138 | 138 | 'publicShareKeyId'); |
139 | 139 | if (empty($this->publicShareKeyId)) { |
140 | - $this->publicShareKeyId = 'pubShare_' . substr(md5(time()), 0, 8); |
|
140 | + $this->publicShareKeyId = 'pubShare_'.substr(md5(time()), 0, 8); |
|
141 | 141 | $this->config->setAppValue('encryption', 'publicShareKeyId', $this->publicShareKeyId); |
142 | 142 | } |
143 | 143 | |
144 | 144 | $this->masterKeyId = $this->config->getAppValue('encryption', |
145 | 145 | 'masterKeyId'); |
146 | 146 | if (empty($this->masterKeyId)) { |
147 | - $this->masterKeyId = 'master_' . substr(md5(time()), 0, 8); |
|
147 | + $this->masterKeyId = 'master_'.substr(md5(time()), 0, 8); |
|
148 | 148 | $this->config->setAppValue('encryption', 'masterKeyId', $this->masterKeyId); |
149 | 149 | } |
150 | 150 | |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | |
163 | 163 | // Save public key |
164 | 164 | $this->keyStorage->setSystemUserKey( |
165 | - $this->publicShareKeyId . '.publicKey', $keyPair['publicKey'], |
|
165 | + $this->publicShareKeyId.'.publicKey', $keyPair['publicKey'], |
|
166 | 166 | Encryption::ID); |
167 | 167 | |
168 | 168 | // Encrypt private key empty passphrase |
169 | 169 | $encryptedKey = $this->crypt->encryptPrivateKey($keyPair['privateKey'], ''); |
170 | 170 | $header = $this->crypt->generateHeader(); |
171 | - $this->setSystemPrivateKey($this->publicShareKeyId, $header . $encryptedKey); |
|
171 | + $this->setSystemPrivateKey($this->publicShareKeyId, $header.$encryptedKey); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
@@ -182,13 +182,13 @@ discard block |
||
182 | 182 | |
183 | 183 | // Save public key |
184 | 184 | $this->keyStorage->setSystemUserKey( |
185 | - $this->masterKeyId . '.publicKey', $keyPair['publicKey'], |
|
185 | + $this->masterKeyId.'.publicKey', $keyPair['publicKey'], |
|
186 | 186 | Encryption::ID); |
187 | 187 | |
188 | 188 | // Encrypt private key with system password |
189 | 189 | $encryptedKey = $this->crypt->encryptPrivateKey($keyPair['privateKey'], $this->getMasterKeyPassword(), $this->masterKeyId); |
190 | 190 | $header = $this->crypt->generateHeader(); |
191 | - $this->setSystemPrivateKey($this->masterKeyId, $header . $encryptedKey); |
|
191 | + $this->setSystemPrivateKey($this->masterKeyId, $header.$encryptedKey); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * @return string |
207 | 207 | */ |
208 | 208 | public function getRecoveryKey() { |
209 | - return $this->keyStorage->getSystemUserKey($this->recoveryKeyId . '.publicKey', Encryption::ID); |
|
209 | + return $this->keyStorage->getSystemUserKey($this->recoveryKeyId.'.publicKey', Encryption::ID); |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | /** |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * @return bool |
224 | 224 | */ |
225 | 225 | public function checkRecoveryPassword($password) { |
226 | - $recoveryKey = $this->keyStorage->getSystemUserKey($this->recoveryKeyId . '.privateKey', Encryption::ID); |
|
226 | + $recoveryKey = $this->keyStorage->getSystemUserKey($this->recoveryKeyId.'.privateKey', Encryption::ID); |
|
227 | 227 | $decryptedRecoveryKey = $this->crypt->decryptPrivateKey($recoveryKey, $password); |
228 | 228 | |
229 | 229 | if ($decryptedRecoveryKey) { |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | $header = $this->crypt->generateHeader(); |
248 | 248 | |
249 | 249 | if ($encryptedKey) { |
250 | - $this->setPrivateKey($uid, $header . $encryptedKey); |
|
250 | + $this->setPrivateKey($uid, $header.$encryptedKey); |
|
251 | 251 | return true; |
252 | 252 | } |
253 | 253 | return false; |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $header = $this->crypt->generateHeader(); |
270 | 270 | |
271 | 271 | if ($encryptedKey) { |
272 | - $this->setSystemPrivateKey($this->getRecoveryKeyId(), $header . $encryptedKey); |
|
272 | + $this->setSystemPrivateKey($this->getRecoveryKeyId(), $header.$encryptedKey); |
|
273 | 273 | return true; |
274 | 274 | } |
275 | 275 | return false; |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | * @return boolean |
330 | 330 | */ |
331 | 331 | public function setShareKey($path, $uid, $key) { |
332 | - $keyId = $uid . '.' . $this->shareKeyId; |
|
332 | + $keyId = $uid.'.'.$this->shareKeyId; |
|
333 | 333 | return $this->keyStorage->setFileKey($path, $keyId, $key, Encryption::ID); |
334 | 334 | } |
335 | 335 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | |
347 | 347 | |
348 | 348 | try { |
349 | - if($this->util->isMasterKeyEnabled()) { |
|
349 | + if ($this->util->isMasterKeyEnabled()) { |
|
350 | 350 | $uid = $this->getMasterKeyId(); |
351 | 351 | $passPhrase = $this->getMasterKeyPassword(); |
352 | 352 | $privateKey = $this->getSystemPrivateKey($uid); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | return false; |
361 | 361 | } catch (\Exception $e) { |
362 | 362 | $this->log->warning( |
363 | - 'Could not decrypt the private key from user "' . $uid . '"" during login. ' . |
|
363 | + 'Could not decrypt the private key from user "'.$uid.'"" during login. '. |
|
364 | 364 | 'Assume password change on the user back-end. Error message: ' |
365 | 365 | . $e->getMessage() |
366 | 366 | ); |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | if (is_null($uid)) { |
403 | 403 | $uid = $this->getPublicShareKeyId(); |
404 | 404 | $shareKey = $this->getShareKey($path, $uid); |
405 | - $privateKey = $this->keyStorage->getSystemUserKey($this->publicShareKeyId . '.privateKey', Encryption::ID); |
|
405 | + $privateKey = $this->keyStorage->getSystemUserKey($this->publicShareKeyId.'.privateKey', Encryption::ID); |
|
406 | 406 | $privateKey = $this->crypt->decryptPrivateKey($privateKey); |
407 | 407 | } else { |
408 | 408 | |
@@ -432,7 +432,7 @@ discard block |
||
432 | 432 | */ |
433 | 433 | public function getVersion($path, View $view) { |
434 | 434 | $fileInfo = $view->getFileInfo($path); |
435 | - if($fileInfo === false) { |
|
435 | + if ($fileInfo === false) { |
|
436 | 436 | return 0; |
437 | 437 | } |
438 | 438 | return $fileInfo->getEncryptedVersion(); |
@@ -446,9 +446,9 @@ discard block |
||
446 | 446 | * @param View $view |
447 | 447 | */ |
448 | 448 | public function setVersion($path, $version, View $view) { |
449 | - $fileInfo= $view->getFileInfo($path); |
|
449 | + $fileInfo = $view->getFileInfo($path); |
|
450 | 450 | |
451 | - if($fileInfo !== false) { |
|
451 | + if ($fileInfo !== false) { |
|
452 | 452 | $cache = $fileInfo->getStorage()->getCache(); |
453 | 453 | $cache->update($fileInfo->getId(), ['encrypted' => $version, 'encryptedVersion' => $version]); |
454 | 454 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | public function deleteShareKey($path, $keyId) { |
478 | 478 | return $this->keyStorage->deleteFileKey( |
479 | 479 | $path, |
480 | - $keyId . '.' . $this->shareKeyId, |
|
480 | + $keyId.'.'.$this->shareKeyId, |
|
481 | 481 | Encryption::ID); |
482 | 482 | } |
483 | 483 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | * @return mixed |
489 | 489 | */ |
490 | 490 | public function getShareKey($path, $uid) { |
491 | - $keyId = $uid . '.' . $this->shareKeyId; |
|
491 | + $keyId = $uid.'.'.$this->shareKeyId; |
|
492 | 492 | return $this->keyStorage->getFileKey($path, $keyId, Encryption::ID); |
493 | 493 | } |
494 | 494 | |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | * @return string |
551 | 551 | */ |
552 | 552 | public function getPublicShareKey() { |
553 | - return $this->keyStorage->getSystemUserKey($this->publicShareKeyId . '.publicKey', Encryption::ID); |
|
553 | + return $this->keyStorage->getSystemUserKey($this->publicShareKeyId.'.publicKey', Encryption::ID); |
|
554 | 554 | } |
555 | 555 | |
556 | 556 | /** |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | * @return string returns openssl key |
621 | 621 | */ |
622 | 622 | public function getSystemPrivateKey($keyId) { |
623 | - return $this->keyStorage->getSystemUserKey($keyId . '.' . $this->privateKeyId, Encryption::ID); |
|
623 | + return $this->keyStorage->getSystemUserKey($keyId.'.'.$this->privateKeyId, Encryption::ID); |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | /** |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | */ |
631 | 631 | public function setSystemPrivateKey($keyId, $key) { |
632 | 632 | return $this->keyStorage->setSystemUserKey( |
633 | - $keyId . '.' . $this->privateKeyId, |
|
633 | + $keyId.'.'.$this->privateKeyId, |
|
634 | 634 | $key, |
635 | 635 | Encryption::ID); |
636 | 636 | } |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | */ |
671 | 671 | public function getMasterKeyPassword() { |
672 | 672 | $password = $this->config->getSystemValue('secret'); |
673 | - if (empty($password)){ |
|
673 | + if (empty($password)) { |
|
674 | 674 | throw new \Exception('Can not get secret from instance'); |
675 | 675 | } |
676 | 676 | |
@@ -692,6 +692,6 @@ discard block |
||
692 | 692 | * @return string |
693 | 693 | */ |
694 | 694 | public function getPublicMasterKey() { |
695 | - return $this->keyStorage->getSystemUserKey($this->masterKeyId . '.publicKey', Encryption::ID); |
|
695 | + return $this->keyStorage->getSystemUserKey($this->masterKeyId.'.publicKey', Encryption::ID); |
|
696 | 696 | } |
697 | 697 | } |