@@ -33,128 +33,128 @@ |
||
33 | 33 | use OCP\Lock\LockedException; |
34 | 34 | |
35 | 35 | class File extends Node implements \OCP\Files\File { |
36 | - /** |
|
37 | - * Creates a Folder that represents a non-existing path |
|
38 | - * |
|
39 | - * @param string $path path |
|
40 | - * @return string non-existing node class |
|
41 | - */ |
|
42 | - protected function createNonExistingNode($path) { |
|
43 | - return new NonExistingFile($this->root, $this->view, $path); |
|
44 | - } |
|
36 | + /** |
|
37 | + * Creates a Folder that represents a non-existing path |
|
38 | + * |
|
39 | + * @param string $path path |
|
40 | + * @return string non-existing node class |
|
41 | + */ |
|
42 | + protected function createNonExistingNode($path) { |
|
43 | + return new NonExistingFile($this->root, $this->view, $path); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * @return string |
|
48 | - * @throws NotPermittedException |
|
49 | - * @throws LockedException |
|
50 | - */ |
|
51 | - public function getContent() { |
|
52 | - if ($this->checkPermissions(\OCP\Constants::PERMISSION_READ)) { |
|
53 | - /** |
|
54 | - * @var \OC\Files\Storage\Storage $storage; |
|
55 | - */ |
|
56 | - return $this->view->file_get_contents($this->path); |
|
57 | - } else { |
|
58 | - throw new NotPermittedException(); |
|
59 | - } |
|
60 | - } |
|
46 | + /** |
|
47 | + * @return string |
|
48 | + * @throws NotPermittedException |
|
49 | + * @throws LockedException |
|
50 | + */ |
|
51 | + public function getContent() { |
|
52 | + if ($this->checkPermissions(\OCP\Constants::PERMISSION_READ)) { |
|
53 | + /** |
|
54 | + * @var \OC\Files\Storage\Storage $storage; |
|
55 | + */ |
|
56 | + return $this->view->file_get_contents($this->path); |
|
57 | + } else { |
|
58 | + throw new NotPermittedException(); |
|
59 | + } |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @param string|resource $data |
|
64 | - * @throws NotPermittedException |
|
65 | - * @throws \OCP\Files\GenericFileException |
|
66 | - * @throws LockedException |
|
67 | - */ |
|
68 | - public function putContent($data) { |
|
69 | - if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) { |
|
70 | - $this->sendHooks(['preWrite']); |
|
71 | - if ($this->view->file_put_contents($this->path, $data) === false) { |
|
72 | - throw new GenericFileException('file_put_contents failed'); |
|
73 | - } |
|
74 | - $this->fileInfo = null; |
|
75 | - $this->sendHooks(['postWrite']); |
|
76 | - } else { |
|
77 | - throw new NotPermittedException(); |
|
78 | - } |
|
79 | - } |
|
62 | + /** |
|
63 | + * @param string|resource $data |
|
64 | + * @throws NotPermittedException |
|
65 | + * @throws \OCP\Files\GenericFileException |
|
66 | + * @throws LockedException |
|
67 | + */ |
|
68 | + public function putContent($data) { |
|
69 | + if ($this->checkPermissions(\OCP\Constants::PERMISSION_UPDATE)) { |
|
70 | + $this->sendHooks(['preWrite']); |
|
71 | + if ($this->view->file_put_contents($this->path, $data) === false) { |
|
72 | + throw new GenericFileException('file_put_contents failed'); |
|
73 | + } |
|
74 | + $this->fileInfo = null; |
|
75 | + $this->sendHooks(['postWrite']); |
|
76 | + } else { |
|
77 | + throw new NotPermittedException(); |
|
78 | + } |
|
79 | + } |
|
80 | 80 | |
81 | - /** |
|
82 | - * @param string $mode |
|
83 | - * @return resource |
|
84 | - * @throws NotPermittedException |
|
85 | - * @throws LockedException |
|
86 | - */ |
|
87 | - public function fopen($mode) { |
|
88 | - $preHooks = []; |
|
89 | - $postHooks = []; |
|
90 | - $requiredPermissions = \OCP\Constants::PERMISSION_READ; |
|
91 | - switch ($mode) { |
|
92 | - case 'r+': |
|
93 | - case 'rb+': |
|
94 | - case 'w+': |
|
95 | - case 'wb+': |
|
96 | - case 'x+': |
|
97 | - case 'xb+': |
|
98 | - case 'a+': |
|
99 | - case 'ab+': |
|
100 | - case 'w': |
|
101 | - case 'wb': |
|
102 | - case 'x': |
|
103 | - case 'xb': |
|
104 | - case 'a': |
|
105 | - case 'ab': |
|
106 | - $preHooks[] = 'preWrite'; |
|
107 | - $postHooks[] = 'postWrite'; |
|
108 | - $requiredPermissions |= \OCP\Constants::PERMISSION_UPDATE; |
|
109 | - break; |
|
110 | - } |
|
81 | + /** |
|
82 | + * @param string $mode |
|
83 | + * @return resource |
|
84 | + * @throws NotPermittedException |
|
85 | + * @throws LockedException |
|
86 | + */ |
|
87 | + public function fopen($mode) { |
|
88 | + $preHooks = []; |
|
89 | + $postHooks = []; |
|
90 | + $requiredPermissions = \OCP\Constants::PERMISSION_READ; |
|
91 | + switch ($mode) { |
|
92 | + case 'r+': |
|
93 | + case 'rb+': |
|
94 | + case 'w+': |
|
95 | + case 'wb+': |
|
96 | + case 'x+': |
|
97 | + case 'xb+': |
|
98 | + case 'a+': |
|
99 | + case 'ab+': |
|
100 | + case 'w': |
|
101 | + case 'wb': |
|
102 | + case 'x': |
|
103 | + case 'xb': |
|
104 | + case 'a': |
|
105 | + case 'ab': |
|
106 | + $preHooks[] = 'preWrite'; |
|
107 | + $postHooks[] = 'postWrite'; |
|
108 | + $requiredPermissions |= \OCP\Constants::PERMISSION_UPDATE; |
|
109 | + break; |
|
110 | + } |
|
111 | 111 | |
112 | - if ($this->checkPermissions($requiredPermissions)) { |
|
113 | - $this->sendHooks($preHooks); |
|
114 | - $result = $this->view->fopen($this->path, $mode); |
|
115 | - $this->sendHooks($postHooks); |
|
116 | - return $result; |
|
117 | - } else { |
|
118 | - throw new NotPermittedException(); |
|
119 | - } |
|
120 | - } |
|
112 | + if ($this->checkPermissions($requiredPermissions)) { |
|
113 | + $this->sendHooks($preHooks); |
|
114 | + $result = $this->view->fopen($this->path, $mode); |
|
115 | + $this->sendHooks($postHooks); |
|
116 | + return $result; |
|
117 | + } else { |
|
118 | + throw new NotPermittedException(); |
|
119 | + } |
|
120 | + } |
|
121 | 121 | |
122 | - /** |
|
123 | - * @throws NotPermittedException |
|
124 | - * @throws \OCP\Files\InvalidPathException |
|
125 | - * @throws \OCP\Files\NotFoundException |
|
126 | - */ |
|
127 | - public function delete() { |
|
128 | - if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) { |
|
129 | - $this->sendHooks(['preDelete']); |
|
130 | - $fileInfo = $this->getFileInfo(); |
|
131 | - $this->view->unlink($this->path); |
|
132 | - $nonExisting = new NonExistingFile($this->root, $this->view, $this->path, $fileInfo); |
|
133 | - $this->sendHooks(['postDelete'], [$nonExisting]); |
|
134 | - $this->exists = false; |
|
135 | - $this->fileInfo = null; |
|
136 | - } else { |
|
137 | - throw new NotPermittedException(); |
|
138 | - } |
|
139 | - } |
|
122 | + /** |
|
123 | + * @throws NotPermittedException |
|
124 | + * @throws \OCP\Files\InvalidPathException |
|
125 | + * @throws \OCP\Files\NotFoundException |
|
126 | + */ |
|
127 | + public function delete() { |
|
128 | + if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) { |
|
129 | + $this->sendHooks(['preDelete']); |
|
130 | + $fileInfo = $this->getFileInfo(); |
|
131 | + $this->view->unlink($this->path); |
|
132 | + $nonExisting = new NonExistingFile($this->root, $this->view, $this->path, $fileInfo); |
|
133 | + $this->sendHooks(['postDelete'], [$nonExisting]); |
|
134 | + $this->exists = false; |
|
135 | + $this->fileInfo = null; |
|
136 | + } else { |
|
137 | + throw new NotPermittedException(); |
|
138 | + } |
|
139 | + } |
|
140 | 140 | |
141 | - /** |
|
142 | - * @param string $type |
|
143 | - * @param bool $raw |
|
144 | - * @return string |
|
145 | - */ |
|
146 | - public function hash($type, $raw = false) { |
|
147 | - return $this->view->hash($type, $this->path, $raw); |
|
148 | - } |
|
141 | + /** |
|
142 | + * @param string $type |
|
143 | + * @param bool $raw |
|
144 | + * @return string |
|
145 | + */ |
|
146 | + public function hash($type, $raw = false) { |
|
147 | + return $this->view->hash($type, $this->path, $raw); |
|
148 | + } |
|
149 | 149 | |
150 | - /** |
|
151 | - * @inheritdoc |
|
152 | - */ |
|
153 | - public function getChecksum() { |
|
154 | - return $this->getFileInfo()->getChecksum(); |
|
155 | - } |
|
150 | + /** |
|
151 | + * @inheritdoc |
|
152 | + */ |
|
153 | + public function getChecksum() { |
|
154 | + return $this->getFileInfo()->getChecksum(); |
|
155 | + } |
|
156 | 156 | |
157 | - public function getExtension(): string { |
|
158 | - return $this->getFileInfo()->getExtension(); |
|
159 | - } |
|
157 | + public function getExtension(): string { |
|
158 | + return $this->getFileInfo()->getExtension(); |
|
159 | + } |
|
160 | 160 | } |
@@ -29,40 +29,40 @@ |
||
29 | 29 | * @deprecated 18.0.0 |
30 | 30 | */ |
31 | 31 | class TemplateManager { |
32 | - protected $templates = []; |
|
32 | + protected $templates = []; |
|
33 | 33 | |
34 | - public function registerTemplate($mimetype, $path) { |
|
35 | - $this->templates[$mimetype] = $path; |
|
36 | - } |
|
34 | + public function registerTemplate($mimetype, $path) { |
|
35 | + $this->templates[$mimetype] = $path; |
|
36 | + } |
|
37 | 37 | |
38 | - /** |
|
39 | - * get the path of the template for a mimetype |
|
40 | - * |
|
41 | - * @deprecated 18.0.0 |
|
42 | - * @param string $mimetype |
|
43 | - * @return string|null |
|
44 | - */ |
|
45 | - public function getTemplatePath($mimetype) { |
|
46 | - if (isset($this->templates[$mimetype])) { |
|
47 | - return $this->templates[$mimetype]; |
|
48 | - } else { |
|
49 | - return null; |
|
50 | - } |
|
51 | - } |
|
38 | + /** |
|
39 | + * get the path of the template for a mimetype |
|
40 | + * |
|
41 | + * @deprecated 18.0.0 |
|
42 | + * @param string $mimetype |
|
43 | + * @return string|null |
|
44 | + */ |
|
45 | + public function getTemplatePath($mimetype) { |
|
46 | + if (isset($this->templates[$mimetype])) { |
|
47 | + return $this->templates[$mimetype]; |
|
48 | + } else { |
|
49 | + return null; |
|
50 | + } |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * get the template content for a mimetype |
|
55 | - * |
|
56 | - * @deprecated 18.0.0 |
|
57 | - * @param string $mimetype |
|
58 | - * @return string |
|
59 | - */ |
|
60 | - public function getTemplate($mimetype) { |
|
61 | - $path = $this->getTemplatePath($mimetype); |
|
62 | - if ($path) { |
|
63 | - return file_get_contents($path); |
|
64 | - } else { |
|
65 | - return ''; |
|
66 | - } |
|
67 | - } |
|
53 | + /** |
|
54 | + * get the template content for a mimetype |
|
55 | + * |
|
56 | + * @deprecated 18.0.0 |
|
57 | + * @param string $mimetype |
|
58 | + * @return string |
|
59 | + */ |
|
60 | + public function getTemplate($mimetype) { |
|
61 | + $path = $this->getTemplatePath($mimetype); |
|
62 | + if ($path) { |
|
63 | + return file_get_contents($path); |
|
64 | + } else { |
|
65 | + return ''; |
|
66 | + } |
|
67 | + } |
|
68 | 68 | } |
@@ -26,14 +26,14 @@ discard block |
||
26 | 26 | use OC\DB\ConnectionFactory; |
27 | 27 | |
28 | 28 | class Sqlite extends AbstractDatabase { |
29 | - public $dbprettyname = 'Sqlite'; |
|
29 | + public $dbprettyname = 'Sqlite'; |
|
30 | 30 | |
31 | - public function validate($config) { |
|
32 | - return []; |
|
33 | - } |
|
31 | + public function validate($config) { |
|
32 | + return []; |
|
33 | + } |
|
34 | 34 | |
35 | - public function initialize($config) { |
|
36 | - /* |
|
35 | + public function initialize($config) { |
|
36 | + /* |
|
37 | 37 | * Web: When using web based installer its not possible to set dbname |
38 | 38 | * or dbtableprefix. Defaults used from ConnectionFactory and dbtype = 'sqlite' |
39 | 39 | * is written to config.php. |
@@ -44,32 +44,32 @@ discard block |
||
44 | 44 | * in connection factory configuration is obtained from config.php. |
45 | 45 | */ |
46 | 46 | |
47 | - $this->dbName = empty($config['dbname']) |
|
48 | - ? ConnectionFactory::DEFAULT_DBNAME |
|
49 | - : $config['dbname']; |
|
47 | + $this->dbName = empty($config['dbname']) |
|
48 | + ? ConnectionFactory::DEFAULT_DBNAME |
|
49 | + : $config['dbname']; |
|
50 | 50 | |
51 | - $this->tablePrefix = empty($config['dbtableprefix']) |
|
52 | - ? ConnectionFactory::DEFAULT_DBTABLEPREFIX |
|
53 | - : $config['dbtableprefix']; |
|
51 | + $this->tablePrefix = empty($config['dbtableprefix']) |
|
52 | + ? ConnectionFactory::DEFAULT_DBTABLEPREFIX |
|
53 | + : $config['dbtableprefix']; |
|
54 | 54 | |
55 | - if ($this->dbName !== ConnectionFactory::DEFAULT_DBNAME) { |
|
56 | - $this->config->setValue('dbname', $this->dbName); |
|
57 | - } |
|
55 | + if ($this->dbName !== ConnectionFactory::DEFAULT_DBNAME) { |
|
56 | + $this->config->setValue('dbname', $this->dbName); |
|
57 | + } |
|
58 | 58 | |
59 | - if ($this->tablePrefix !== ConnectionFactory::DEFAULT_DBTABLEPREFIX) { |
|
60 | - $this->config->setValue('dbtableprefix', $this->tablePrefix); |
|
61 | - } |
|
62 | - } |
|
59 | + if ($this->tablePrefix !== ConnectionFactory::DEFAULT_DBTABLEPREFIX) { |
|
60 | + $this->config->setValue('dbtableprefix', $this->tablePrefix); |
|
61 | + } |
|
62 | + } |
|
63 | 63 | |
64 | - public function setupDatabase($username) { |
|
65 | - $datadir = $this->config->getValue( |
|
66 | - 'datadirectory', |
|
67 | - \OC::$SERVERROOT . '/data' |
|
68 | - ); |
|
64 | + public function setupDatabase($username) { |
|
65 | + $datadir = $this->config->getValue( |
|
66 | + 'datadirectory', |
|
67 | + \OC::$SERVERROOT . '/data' |
|
68 | + ); |
|
69 | 69 | |
70 | - $sqliteFile = $datadir . '/' . $this->dbName . 'db'; |
|
71 | - if (file_exists($sqliteFile)) { |
|
72 | - unlink($sqliteFile); |
|
73 | - } |
|
74 | - } |
|
70 | + $sqliteFile = $datadir . '/' . $this->dbName . 'db'; |
|
71 | + if (file_exists($sqliteFile)) { |
|
72 | + unlink($sqliteFile); |
|
73 | + } |
|
74 | + } |
|
75 | 75 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | <h2 class="title"><?php p($l->t('App update required')); ?></h2> |
5 | 5 | <?php } else { ?> |
6 | 6 | <h2 class="title"><?php p($l->t('%1$s will be updated to version %2$s', |
7 | - [$_['productName'], $_['version']])); ?></h2> |
|
7 | + [$_['productName'], $_['version']])); ?></h2> |
|
8 | 8 | <?php } ?> |
9 | 9 | <?php if (!empty($_['appsToUpgrade'])) { ?> |
10 | 10 | <div class="infogroup"> |
@@ -31,67 +31,67 @@ |
||
31 | 31 | use OCP\Files\FileInfo; |
32 | 32 | |
33 | 33 | abstract class AbstractTrash implements ITrash { |
34 | - /** @var ITrashItem */ |
|
35 | - protected $data; |
|
34 | + /** @var ITrashItem */ |
|
35 | + protected $data; |
|
36 | 36 | |
37 | - /** @var ITrashManager */ |
|
38 | - protected $trashManager; |
|
37 | + /** @var ITrashManager */ |
|
38 | + protected $trashManager; |
|
39 | 39 | |
40 | - public function __construct(ITrashManager $trashManager, ITrashItem $data) { |
|
41 | - $this->trashManager = $trashManager; |
|
42 | - $this->data = $data; |
|
43 | - } |
|
40 | + public function __construct(ITrashManager $trashManager, ITrashItem $data) { |
|
41 | + $this->trashManager = $trashManager; |
|
42 | + $this->data = $data; |
|
43 | + } |
|
44 | 44 | |
45 | - public function getFilename(): string { |
|
46 | - return $this->data->getName(); |
|
47 | - } |
|
45 | + public function getFilename(): string { |
|
46 | + return $this->data->getName(); |
|
47 | + } |
|
48 | 48 | |
49 | - public function getDeletionTime(): int { |
|
50 | - return $this->data->getDeletedTime(); |
|
51 | - } |
|
49 | + public function getDeletionTime(): int { |
|
50 | + return $this->data->getDeletedTime(); |
|
51 | + } |
|
52 | 52 | |
53 | - public function getFileId(): int { |
|
54 | - return $this->data->getId(); |
|
55 | - } |
|
53 | + public function getFileId(): int { |
|
54 | + return $this->data->getId(); |
|
55 | + } |
|
56 | 56 | |
57 | - public function getFileInfo(): FileInfo { |
|
58 | - return $this->data; |
|
59 | - } |
|
57 | + public function getFileInfo(): FileInfo { |
|
58 | + return $this->data; |
|
59 | + } |
|
60 | 60 | |
61 | - public function getSize(): int { |
|
62 | - return $this->data->getSize(); |
|
63 | - } |
|
61 | + public function getSize(): int { |
|
62 | + return $this->data->getSize(); |
|
63 | + } |
|
64 | 64 | |
65 | - public function getLastModified(): int { |
|
66 | - return $this->data->getMtime(); |
|
67 | - } |
|
65 | + public function getLastModified(): int { |
|
66 | + return $this->data->getMtime(); |
|
67 | + } |
|
68 | 68 | |
69 | - public function getContentType(): string { |
|
70 | - return $this->data->getMimetype(); |
|
71 | - } |
|
69 | + public function getContentType(): string { |
|
70 | + return $this->data->getMimetype(); |
|
71 | + } |
|
72 | 72 | |
73 | - public function getETag(): string { |
|
74 | - return $this->data->getEtag(); |
|
75 | - } |
|
73 | + public function getETag(): string { |
|
74 | + return $this->data->getEtag(); |
|
75 | + } |
|
76 | 76 | |
77 | - public function getName(): string { |
|
78 | - return $this->data->getName(); |
|
79 | - } |
|
77 | + public function getName(): string { |
|
78 | + return $this->data->getName(); |
|
79 | + } |
|
80 | 80 | |
81 | - public function getOriginalLocation(): string { |
|
82 | - return $this->data->getOriginalLocation(); |
|
83 | - } |
|
81 | + public function getOriginalLocation(): string { |
|
82 | + return $this->data->getOriginalLocation(); |
|
83 | + } |
|
84 | 84 | |
85 | - public function getTitle(): string { |
|
86 | - return $this->data->getTitle(); |
|
87 | - } |
|
85 | + public function getTitle(): string { |
|
86 | + return $this->data->getTitle(); |
|
87 | + } |
|
88 | 88 | |
89 | - public function delete() { |
|
90 | - $this->trashManager->removeItem($this->data); |
|
91 | - } |
|
89 | + public function delete() { |
|
90 | + $this->trashManager->removeItem($this->data); |
|
91 | + } |
|
92 | 92 | |
93 | - public function restore(): bool { |
|
94 | - $this->trashManager->restoreItem($this->data); |
|
95 | - return true; |
|
96 | - } |
|
93 | + public function restore(): bool { |
|
94 | + $this->trashManager->restoreItem($this->data); |
|
95 | + return true; |
|
96 | + } |
|
97 | 97 | } |
@@ -28,16 +28,16 @@ |
||
28 | 28 | |
29 | 29 | class LoginFailed extends Event { |
30 | 30 | |
31 | - /** @var string */ |
|
32 | - private $loginName; |
|
31 | + /** @var string */ |
|
32 | + private $loginName; |
|
33 | 33 | |
34 | - public function __construct(string $loginName) { |
|
35 | - parent::__construct(); |
|
34 | + public function __construct(string $loginName) { |
|
35 | + parent::__construct(); |
|
36 | 36 | |
37 | - $this->loginName = $loginName; |
|
38 | - } |
|
37 | + $this->loginName = $loginName; |
|
38 | + } |
|
39 | 39 | |
40 | - public function getLoginName(): string { |
|
41 | - return $this->loginName; |
|
42 | - } |
|
40 | + public function getLoginName(): string { |
|
41 | + return $this->loginName; |
|
42 | + } |
|
43 | 43 | } |
@@ -33,48 +33,48 @@ |
||
33 | 33 | |
34 | 34 | class WebAuthn implements ISettings { |
35 | 35 | |
36 | - /** @var PublicKeyCredentialMapper */ |
|
37 | - private $mapper; |
|
36 | + /** @var PublicKeyCredentialMapper */ |
|
37 | + private $mapper; |
|
38 | 38 | |
39 | - /** @var string */ |
|
40 | - private $uid; |
|
39 | + /** @var string */ |
|
40 | + private $uid; |
|
41 | 41 | |
42 | - /** @var IInitialStateService */ |
|
43 | - private $initialStateService; |
|
42 | + /** @var IInitialStateService */ |
|
43 | + private $initialStateService; |
|
44 | 44 | |
45 | - /** @var Manager */ |
|
46 | - private $manager; |
|
45 | + /** @var Manager */ |
|
46 | + private $manager; |
|
47 | 47 | |
48 | - public function __construct(PublicKeyCredentialMapper $mapper, |
|
49 | - string $UserId, |
|
50 | - IInitialStateService $initialStateService, |
|
51 | - Manager $manager) { |
|
52 | - $this->mapper = $mapper; |
|
53 | - $this->uid = $UserId; |
|
54 | - $this->initialStateService = $initialStateService; |
|
55 | - $this->manager = $manager; |
|
56 | - } |
|
48 | + public function __construct(PublicKeyCredentialMapper $mapper, |
|
49 | + string $UserId, |
|
50 | + IInitialStateService $initialStateService, |
|
51 | + Manager $manager) { |
|
52 | + $this->mapper = $mapper; |
|
53 | + $this->uid = $UserId; |
|
54 | + $this->initialStateService = $initialStateService; |
|
55 | + $this->manager = $manager; |
|
56 | + } |
|
57 | 57 | |
58 | - public function getForm() { |
|
59 | - $this->initialStateService->provideInitialState( |
|
60 | - Application::APP_ID, |
|
61 | - 'webauthn-devices', |
|
62 | - $this->mapper->findAllForUid($this->uid) |
|
63 | - ); |
|
58 | + public function getForm() { |
|
59 | + $this->initialStateService->provideInitialState( |
|
60 | + Application::APP_ID, |
|
61 | + 'webauthn-devices', |
|
62 | + $this->mapper->findAllForUid($this->uid) |
|
63 | + ); |
|
64 | 64 | |
65 | - return new TemplateResponse('settings', 'settings/personal/security/webauthn', [ |
|
66 | - ]); |
|
67 | - } |
|
65 | + return new TemplateResponse('settings', 'settings/personal/security/webauthn', [ |
|
66 | + ]); |
|
67 | + } |
|
68 | 68 | |
69 | - public function getSection(): ?string { |
|
70 | - if (!$this->manager->isWebAuthnAvailable()) { |
|
71 | - return null; |
|
72 | - } |
|
69 | + public function getSection(): ?string { |
|
70 | + if (!$this->manager->isWebAuthnAvailable()) { |
|
71 | + return null; |
|
72 | + } |
|
73 | 73 | |
74 | - return 'security'; |
|
75 | - } |
|
74 | + return 'security'; |
|
75 | + } |
|
76 | 76 | |
77 | - public function getPriority(): int { |
|
78 | - return 20; |
|
79 | - } |
|
77 | + public function getPriority(): int { |
|
78 | + return 20; |
|
79 | + } |
|
80 | 80 | } |
@@ -25,72 +25,72 @@ |
||
25 | 25 | namespace OC\Authentication\Login; |
26 | 26 | |
27 | 27 | class WebAuthnChain { |
28 | - /** @var UserDisabledCheckCommand */ |
|
29 | - private $userDisabledCheckCommand; |
|
28 | + /** @var UserDisabledCheckCommand */ |
|
29 | + private $userDisabledCheckCommand; |
|
30 | 30 | |
31 | - /** @var LoggedInCheckCommand */ |
|
32 | - private $loggedInCheckCommand; |
|
31 | + /** @var LoggedInCheckCommand */ |
|
32 | + private $loggedInCheckCommand; |
|
33 | 33 | |
34 | - /** @var CompleteLoginCommand */ |
|
35 | - private $completeLoginCommand; |
|
34 | + /** @var CompleteLoginCommand */ |
|
35 | + private $completeLoginCommand; |
|
36 | 36 | |
37 | - /** @var CreateSessionTokenCommand */ |
|
38 | - private $createSessionTokenCommand; |
|
37 | + /** @var CreateSessionTokenCommand */ |
|
38 | + private $createSessionTokenCommand; |
|
39 | 39 | |
40 | - /** @var ClearLostPasswordTokensCommand */ |
|
41 | - private $clearLostPasswordTokensCommand; |
|
40 | + /** @var ClearLostPasswordTokensCommand */ |
|
41 | + private $clearLostPasswordTokensCommand; |
|
42 | 42 | |
43 | - /** @var UpdateLastPasswordConfirmCommand */ |
|
44 | - private $updateLastPasswordConfirmCommand; |
|
43 | + /** @var UpdateLastPasswordConfirmCommand */ |
|
44 | + private $updateLastPasswordConfirmCommand; |
|
45 | 45 | |
46 | - /** @var SetUserTimezoneCommand */ |
|
47 | - private $setUserTimezoneCommand; |
|
46 | + /** @var SetUserTimezoneCommand */ |
|
47 | + private $setUserTimezoneCommand; |
|
48 | 48 | |
49 | - /** @var TwoFactorCommand */ |
|
50 | - private $twoFactorCommand; |
|
49 | + /** @var TwoFactorCommand */ |
|
50 | + private $twoFactorCommand; |
|
51 | 51 | |
52 | - /** @var FinishRememberedLoginCommand */ |
|
53 | - private $finishRememberedLoginCommand; |
|
52 | + /** @var FinishRememberedLoginCommand */ |
|
53 | + private $finishRememberedLoginCommand; |
|
54 | 54 | |
55 | - /** @var WebAuthnLoginCommand */ |
|
56 | - private $webAuthnLoginCommand; |
|
55 | + /** @var WebAuthnLoginCommand */ |
|
56 | + private $webAuthnLoginCommand; |
|
57 | 57 | |
58 | - public function __construct(UserDisabledCheckCommand $userDisabledCheckCommand, |
|
59 | - WebAuthnLoginCommand $webAuthnLoginCommand, |
|
60 | - LoggedInCheckCommand $loggedInCheckCommand, |
|
61 | - CompleteLoginCommand $completeLoginCommand, |
|
62 | - CreateSessionTokenCommand $createSessionTokenCommand, |
|
63 | - ClearLostPasswordTokensCommand $clearLostPasswordTokensCommand, |
|
64 | - UpdateLastPasswordConfirmCommand $updateLastPasswordConfirmCommand, |
|
65 | - SetUserTimezoneCommand $setUserTimezoneCommand, |
|
66 | - TwoFactorCommand $twoFactorCommand, |
|
67 | - FinishRememberedLoginCommand $finishRememberedLoginCommand |
|
68 | - ) { |
|
69 | - $this->userDisabledCheckCommand = $userDisabledCheckCommand; |
|
70 | - $this->webAuthnLoginCommand = $webAuthnLoginCommand; |
|
71 | - $this->loggedInCheckCommand = $loggedInCheckCommand; |
|
72 | - $this->completeLoginCommand = $completeLoginCommand; |
|
73 | - $this->createSessionTokenCommand = $createSessionTokenCommand; |
|
74 | - $this->clearLostPasswordTokensCommand = $clearLostPasswordTokensCommand; |
|
75 | - $this->updateLastPasswordConfirmCommand = $updateLastPasswordConfirmCommand; |
|
76 | - $this->setUserTimezoneCommand = $setUserTimezoneCommand; |
|
77 | - $this->twoFactorCommand = $twoFactorCommand; |
|
78 | - $this->finishRememberedLoginCommand = $finishRememberedLoginCommand; |
|
79 | - } |
|
58 | + public function __construct(UserDisabledCheckCommand $userDisabledCheckCommand, |
|
59 | + WebAuthnLoginCommand $webAuthnLoginCommand, |
|
60 | + LoggedInCheckCommand $loggedInCheckCommand, |
|
61 | + CompleteLoginCommand $completeLoginCommand, |
|
62 | + CreateSessionTokenCommand $createSessionTokenCommand, |
|
63 | + ClearLostPasswordTokensCommand $clearLostPasswordTokensCommand, |
|
64 | + UpdateLastPasswordConfirmCommand $updateLastPasswordConfirmCommand, |
|
65 | + SetUserTimezoneCommand $setUserTimezoneCommand, |
|
66 | + TwoFactorCommand $twoFactorCommand, |
|
67 | + FinishRememberedLoginCommand $finishRememberedLoginCommand |
|
68 | + ) { |
|
69 | + $this->userDisabledCheckCommand = $userDisabledCheckCommand; |
|
70 | + $this->webAuthnLoginCommand = $webAuthnLoginCommand; |
|
71 | + $this->loggedInCheckCommand = $loggedInCheckCommand; |
|
72 | + $this->completeLoginCommand = $completeLoginCommand; |
|
73 | + $this->createSessionTokenCommand = $createSessionTokenCommand; |
|
74 | + $this->clearLostPasswordTokensCommand = $clearLostPasswordTokensCommand; |
|
75 | + $this->updateLastPasswordConfirmCommand = $updateLastPasswordConfirmCommand; |
|
76 | + $this->setUserTimezoneCommand = $setUserTimezoneCommand; |
|
77 | + $this->twoFactorCommand = $twoFactorCommand; |
|
78 | + $this->finishRememberedLoginCommand = $finishRememberedLoginCommand; |
|
79 | + } |
|
80 | 80 | |
81 | - public function process(LoginData $loginData): LoginResult { |
|
82 | - $chain = $this->userDisabledCheckCommand; |
|
83 | - $chain |
|
84 | - ->setNext($this->webAuthnLoginCommand) |
|
85 | - ->setNext($this->loggedInCheckCommand) |
|
86 | - ->setNext($this->completeLoginCommand) |
|
87 | - ->setNext($this->createSessionTokenCommand) |
|
88 | - ->setNext($this->clearLostPasswordTokensCommand) |
|
89 | - ->setNext($this->updateLastPasswordConfirmCommand) |
|
90 | - ->setNext($this->setUserTimezoneCommand) |
|
91 | - ->setNext($this->twoFactorCommand) |
|
92 | - ->setNext($this->finishRememberedLoginCommand); |
|
81 | + public function process(LoginData $loginData): LoginResult { |
|
82 | + $chain = $this->userDisabledCheckCommand; |
|
83 | + $chain |
|
84 | + ->setNext($this->webAuthnLoginCommand) |
|
85 | + ->setNext($this->loggedInCheckCommand) |
|
86 | + ->setNext($this->completeLoginCommand) |
|
87 | + ->setNext($this->createSessionTokenCommand) |
|
88 | + ->setNext($this->clearLostPasswordTokensCommand) |
|
89 | + ->setNext($this->updateLastPasswordConfirmCommand) |
|
90 | + ->setNext($this->setUserTimezoneCommand) |
|
91 | + ->setNext($this->twoFactorCommand) |
|
92 | + ->setNext($this->finishRememberedLoginCommand); |
|
93 | 93 | |
94 | - return $chain->process($loginData); |
|
95 | - } |
|
94 | + return $chain->process($loginData); |
|
95 | + } |
|
96 | 96 | } |
@@ -28,21 +28,21 @@ |
||
28 | 28 | |
29 | 29 | class WebAuthnLoginCommand extends ALoginCommand { |
30 | 30 | |
31 | - /** @var IUserManager */ |
|
32 | - private $userManager; |
|
33 | - |
|
34 | - public function __construct(IUserManager $userManager) { |
|
35 | - $this->userManager = $userManager; |
|
36 | - } |
|
37 | - |
|
38 | - public function process(LoginData $loginData): LoginResult { |
|
39 | - $user = $this->userManager->get($loginData->getUsername()); |
|
40 | - $loginData->setUser($user); |
|
41 | - if ($user === null) { |
|
42 | - $loginData->setUser(false); |
|
43 | - } |
|
44 | - |
|
45 | - return $this->processNextOrFinishSuccessfully($loginData); |
|
46 | - } |
|
31 | + /** @var IUserManager */ |
|
32 | + private $userManager; |
|
33 | + |
|
34 | + public function __construct(IUserManager $userManager) { |
|
35 | + $this->userManager = $userManager; |
|
36 | + } |
|
37 | + |
|
38 | + public function process(LoginData $loginData): LoginResult { |
|
39 | + $user = $this->userManager->get($loginData->getUsername()); |
|
40 | + $loginData->setUser($user); |
|
41 | + if ($user === null) { |
|
42 | + $loginData->setUser(false); |
|
43 | + } |
|
44 | + |
|
45 | + return $this->processNextOrFinishSuccessfully($loginData); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | } |