@@ -52,145 +52,145 @@ |
||
52 | 52 | $application->add(new OC\Core\Command\App\CheckCode()); |
53 | 53 | $application->add(new OC\Core\Command\L10n\CreateJs()); |
54 | 54 | $application->add(new \OC\Core\Command\Integrity\SignApp( |
55 | - \OC::$server->getIntegrityCodeChecker(), |
|
56 | - new \OC\IntegrityCheck\Helpers\FileAccessHelper(), |
|
57 | - \OC::$server->getURLGenerator() |
|
55 | + \OC::$server->getIntegrityCodeChecker(), |
|
56 | + new \OC\IntegrityCheck\Helpers\FileAccessHelper(), |
|
57 | + \OC::$server->getURLGenerator() |
|
58 | 58 | )); |
59 | 59 | $application->add(new \OC\Core\Command\Integrity\SignCore( |
60 | - \OC::$server->getIntegrityCodeChecker(), |
|
61 | - new \OC\IntegrityCheck\Helpers\FileAccessHelper() |
|
60 | + \OC::$server->getIntegrityCodeChecker(), |
|
61 | + new \OC\IntegrityCheck\Helpers\FileAccessHelper() |
|
62 | 62 | )); |
63 | 63 | $application->add(new \OC\Core\Command\Integrity\CheckApp( |
64 | - \OC::$server->getIntegrityCodeChecker() |
|
64 | + \OC::$server->getIntegrityCodeChecker() |
|
65 | 65 | )); |
66 | 66 | $application->add(new \OC\Core\Command\Integrity\CheckCore( |
67 | - \OC::$server->getIntegrityCodeChecker() |
|
67 | + \OC::$server->getIntegrityCodeChecker() |
|
68 | 68 | )); |
69 | 69 | |
70 | 70 | |
71 | 71 | if (\OC::$server->getConfig()->getSystemValue('installed', false)) { |
72 | - $application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager())); |
|
73 | - $application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager(), \OC::$server->getGroupManager())); |
|
74 | - $application->add(new OC\Core\Command\App\Install()); |
|
75 | - $application->add(new OC\Core\Command\App\GetPath()); |
|
76 | - $application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager())); |
|
77 | - $application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class), \OC::$server->getLogger())); |
|
78 | - $application->add(\OC::$server->query(\OC\Core\Command\App\Update::class)); |
|
79 | - |
|
80 | - $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Cleanup::class)); |
|
81 | - $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enforce::class)); |
|
82 | - $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enable::class)); |
|
83 | - $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Disable::class)); |
|
84 | - $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\State::class)); |
|
85 | - |
|
86 | - $application->add(new OC\Core\Command\Background\Cron(\OC::$server->getConfig())); |
|
87 | - $application->add(new OC\Core\Command\Background\WebCron(\OC::$server->getConfig())); |
|
88 | - $application->add(new OC\Core\Command\Background\Ajax(\OC::$server->getConfig())); |
|
89 | - |
|
90 | - $application->add(\OC::$server->query(\OC\Core\Command\Broadcast\Test::class)); |
|
91 | - |
|
92 | - $application->add(new OC\Core\Command\Config\App\DeleteConfig(\OC::$server->getConfig())); |
|
93 | - $application->add(new OC\Core\Command\Config\App\GetConfig(\OC::$server->getConfig())); |
|
94 | - $application->add(new OC\Core\Command\Config\App\SetConfig(\OC::$server->getConfig())); |
|
95 | - $application->add(new OC\Core\Command\Config\Import(\OC::$server->getConfig())); |
|
96 | - $application->add(new OC\Core\Command\Config\ListConfigs(\OC::$server->getSystemConfig(), \OC::$server->getAppConfig())); |
|
97 | - $application->add(new OC\Core\Command\Config\System\DeleteConfig(\OC::$server->getSystemConfig())); |
|
98 | - $application->add(new OC\Core\Command\Config\System\GetConfig(\OC::$server->getSystemConfig())); |
|
99 | - $application->add(new OC\Core\Command\Config\System\SetConfig(\OC::$server->getSystemConfig())); |
|
100 | - |
|
101 | - $application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig()))); |
|
102 | - $application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->getLogger())); |
|
103 | - $application->add(new OC\Core\Command\Db\ConvertFilecacheBigInt(\OC::$server->getDatabaseConnection())); |
|
104 | - $application->add(new OC\Core\Command\Db\AddMissingIndices(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher())); |
|
105 | - $application->add(new OC\Core\Command\Db\AddMissingColumns(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher())); |
|
106 | - $application->add(new OC\Core\Command\Db\AddMissingPrimaryKeys(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher())); |
|
107 | - $application->add(new OC\Core\Command\Db\Migrations\StatusCommand(\OC::$server->getDatabaseConnection())); |
|
108 | - $application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->getDatabaseConnection())); |
|
109 | - $application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager())); |
|
110 | - $application->add(new OC\Core\Command\Db\Migrations\GenerateFromSchemaFileCommand(\OC::$server->getConfig(), \OC::$server->getAppManager(), \OC::$server->getDatabaseConnection())); |
|
111 | - $application->add(new OC\Core\Command\Db\Migrations\ExecuteCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager(), \OC::$server->getConfig())); |
|
112 | - |
|
113 | - $application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig())); |
|
114 | - $application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager())); |
|
115 | - $application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager(), \OC::$server->getConfig())); |
|
116 | - $application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager(), \OC::$server->getConfig())); |
|
117 | - $application->add(new OC\Core\Command\Encryption\Status(\OC::$server->getEncryptionManager())); |
|
118 | - $application->add(new OC\Core\Command\Encryption\EncryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getAppManager(), \OC::$server->getConfig(), new \Symfony\Component\Console\Helper\QuestionHelper())); |
|
119 | - $application->add(new OC\Core\Command\Encryption\DecryptAll( |
|
120 | - \OC::$server->getEncryptionManager(), |
|
121 | - \OC::$server->getAppManager(), |
|
122 | - \OC::$server->getConfig(), |
|
123 | - new \OC\Encryption\DecryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getUserManager(), new \OC\Files\View()), |
|
124 | - new \Symfony\Component\Console\Helper\QuestionHelper()) |
|
125 | - ); |
|
126 | - |
|
127 | - $application->add(new OC\Core\Command\Log\Manage(\OC::$server->getConfig())); |
|
128 | - $application->add(new OC\Core\Command\Log\File(\OC::$server->getConfig())); |
|
129 | - |
|
130 | - $view = new \OC\Files\View(); |
|
131 | - $util = new \OC\Encryption\Util( |
|
132 | - $view, |
|
133 | - \OC::$server->getUserManager(), |
|
134 | - \OC::$server->getGroupManager(), |
|
135 | - \OC::$server->getConfig() |
|
136 | - ); |
|
137 | - $application->add(new OC\Core\Command\Encryption\ChangeKeyStorageRoot( |
|
138 | - $view, |
|
139 | - \OC::$server->getUserManager(), |
|
140 | - \OC::$server->getConfig(), |
|
141 | - $util, |
|
142 | - new \Symfony\Component\Console\Helper\QuestionHelper() |
|
143 | - ) |
|
144 | - ); |
|
145 | - $application->add(new OC\Core\Command\Encryption\ShowKeyStorageRoot($util)); |
|
146 | - $application->add(new OC\Core\Command\Encryption\MigrateKeyStorage( |
|
147 | - $view, |
|
148 | - \OC::$server->getUserManager(), |
|
149 | - \OC::$server->getConfig(), |
|
150 | - $util, |
|
151 | - \OC::$server->getCrypto() |
|
152 | - ) |
|
153 | - ); |
|
154 | - |
|
155 | - $application->add(new OC\Core\Command\Maintenance\DataFingerprint(\OC::$server->getConfig(), new \OC\AppFramework\Utility\TimeFactory())); |
|
156 | - $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateDB(\OC::$server->getMimeTypeDetector(), \OC::$server->getMimeTypeLoader())); |
|
157 | - $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector())); |
|
158 | - $application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig())); |
|
159 | - $application->add(new OC\Core\Command\Maintenance\UpdateHtaccess()); |
|
160 | - $application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory())); |
|
161 | - |
|
162 | - $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->query(\OC\Installer::class))); |
|
163 | - $application->add(new OC\Core\Command\Maintenance\Repair( |
|
164 | - new \OC\Repair([], \OC::$server->getEventDispatcher()), |
|
165 | - \OC::$server->getConfig(), |
|
166 | - \OC::$server->getEventDispatcher(), |
|
167 | - \OC::$server->getAppManager() |
|
168 | - )); |
|
169 | - |
|
170 | - $application->add(\OC::$server->query(\OC\Core\Command\Preview\Repair::class)); |
|
171 | - |
|
172 | - $application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
173 | - $application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager())); |
|
174 | - $application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager())); |
|
175 | - $application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager())); |
|
176 | - $application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager())); |
|
177 | - $application->add(\OC::$server->get(\OC\Core\Command\User\Report::class)); |
|
178 | - $application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager())); |
|
179 | - $application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig(), \OC::$server->getDatabaseConnection())); |
|
180 | - $application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
181 | - $application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
182 | - $application->add(new OC\Core\Command\User\AddAppPassword(\OC::$server->get(\OCP\IUserManager::class), \OC::$server->get(\OC\Authentication\Token\IProvider::class), \OC::$server->get(\OCP\Security\ISecureRandom::class), \OC::$server->get(\OCP\Security\ICrypto::class))); |
|
183 | - |
|
184 | - $application->add(new OC\Core\Command\Group\Add(\OC::$server->getGroupManager())); |
|
185 | - $application->add(new OC\Core\Command\Group\Delete(\OC::$server->getGroupManager())); |
|
186 | - $application->add(new OC\Core\Command\Group\ListCommand(\OC::$server->getGroupManager())); |
|
187 | - $application->add(new OC\Core\Command\Group\AddUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
188 | - $application->add(new OC\Core\Command\Group\RemoveUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
189 | - |
|
190 | - $application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(), \OC::$server->getL10N('core'))); |
|
191 | - $application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager())); |
|
192 | - $application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager())); |
|
193 | - $application->add(new OC\Core\Command\Security\ResetBruteforceAttempts(\OC::$server->getBruteForceThrottler())); |
|
72 | + $application->add(new OC\Core\Command\App\Disable(\OC::$server->getAppManager())); |
|
73 | + $application->add(new OC\Core\Command\App\Enable(\OC::$server->getAppManager(), \OC::$server->getGroupManager())); |
|
74 | + $application->add(new OC\Core\Command\App\Install()); |
|
75 | + $application->add(new OC\Core\Command\App\GetPath()); |
|
76 | + $application->add(new OC\Core\Command\App\ListApps(\OC::$server->getAppManager())); |
|
77 | + $application->add(new OC\Core\Command\App\Remove(\OC::$server->getAppManager(), \OC::$server->query(\OC\Installer::class), \OC::$server->getLogger())); |
|
78 | + $application->add(\OC::$server->query(\OC\Core\Command\App\Update::class)); |
|
79 | + |
|
80 | + $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Cleanup::class)); |
|
81 | + $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enforce::class)); |
|
82 | + $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Enable::class)); |
|
83 | + $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\Disable::class)); |
|
84 | + $application->add(\OC::$server->query(\OC\Core\Command\TwoFactorAuth\State::class)); |
|
85 | + |
|
86 | + $application->add(new OC\Core\Command\Background\Cron(\OC::$server->getConfig())); |
|
87 | + $application->add(new OC\Core\Command\Background\WebCron(\OC::$server->getConfig())); |
|
88 | + $application->add(new OC\Core\Command\Background\Ajax(\OC::$server->getConfig())); |
|
89 | + |
|
90 | + $application->add(\OC::$server->query(\OC\Core\Command\Broadcast\Test::class)); |
|
91 | + |
|
92 | + $application->add(new OC\Core\Command\Config\App\DeleteConfig(\OC::$server->getConfig())); |
|
93 | + $application->add(new OC\Core\Command\Config\App\GetConfig(\OC::$server->getConfig())); |
|
94 | + $application->add(new OC\Core\Command\Config\App\SetConfig(\OC::$server->getConfig())); |
|
95 | + $application->add(new OC\Core\Command\Config\Import(\OC::$server->getConfig())); |
|
96 | + $application->add(new OC\Core\Command\Config\ListConfigs(\OC::$server->getSystemConfig(), \OC::$server->getAppConfig())); |
|
97 | + $application->add(new OC\Core\Command\Config\System\DeleteConfig(\OC::$server->getSystemConfig())); |
|
98 | + $application->add(new OC\Core\Command\Config\System\GetConfig(\OC::$server->getSystemConfig())); |
|
99 | + $application->add(new OC\Core\Command\Config\System\SetConfig(\OC::$server->getSystemConfig())); |
|
100 | + |
|
101 | + $application->add(new OC\Core\Command\Db\ConvertType(\OC::$server->getConfig(), new \OC\DB\ConnectionFactory(\OC::$server->getSystemConfig()))); |
|
102 | + $application->add(new OC\Core\Command\Db\ConvertMysqlToMB4(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection(), \OC::$server->getURLGenerator(), \OC::$server->getLogger())); |
|
103 | + $application->add(new OC\Core\Command\Db\ConvertFilecacheBigInt(\OC::$server->getDatabaseConnection())); |
|
104 | + $application->add(new OC\Core\Command\Db\AddMissingIndices(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher())); |
|
105 | + $application->add(new OC\Core\Command\Db\AddMissingColumns(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher())); |
|
106 | + $application->add(new OC\Core\Command\Db\AddMissingPrimaryKeys(\OC::$server->getDatabaseConnection(), \OC::$server->getEventDispatcher())); |
|
107 | + $application->add(new OC\Core\Command\Db\Migrations\StatusCommand(\OC::$server->getDatabaseConnection())); |
|
108 | + $application->add(new OC\Core\Command\Db\Migrations\MigrateCommand(\OC::$server->getDatabaseConnection())); |
|
109 | + $application->add(new OC\Core\Command\Db\Migrations\GenerateCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager())); |
|
110 | + $application->add(new OC\Core\Command\Db\Migrations\GenerateFromSchemaFileCommand(\OC::$server->getConfig(), \OC::$server->getAppManager(), \OC::$server->getDatabaseConnection())); |
|
111 | + $application->add(new OC\Core\Command\Db\Migrations\ExecuteCommand(\OC::$server->getDatabaseConnection(), \OC::$server->getAppManager(), \OC::$server->getConfig())); |
|
112 | + |
|
113 | + $application->add(new OC\Core\Command\Encryption\Disable(\OC::$server->getConfig())); |
|
114 | + $application->add(new OC\Core\Command\Encryption\Enable(\OC::$server->getConfig(), \OC::$server->getEncryptionManager())); |
|
115 | + $application->add(new OC\Core\Command\Encryption\ListModules(\OC::$server->getEncryptionManager(), \OC::$server->getConfig())); |
|
116 | + $application->add(new OC\Core\Command\Encryption\SetDefaultModule(\OC::$server->getEncryptionManager(), \OC::$server->getConfig())); |
|
117 | + $application->add(new OC\Core\Command\Encryption\Status(\OC::$server->getEncryptionManager())); |
|
118 | + $application->add(new OC\Core\Command\Encryption\EncryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getAppManager(), \OC::$server->getConfig(), new \Symfony\Component\Console\Helper\QuestionHelper())); |
|
119 | + $application->add(new OC\Core\Command\Encryption\DecryptAll( |
|
120 | + \OC::$server->getEncryptionManager(), |
|
121 | + \OC::$server->getAppManager(), |
|
122 | + \OC::$server->getConfig(), |
|
123 | + new \OC\Encryption\DecryptAll(\OC::$server->getEncryptionManager(), \OC::$server->getUserManager(), new \OC\Files\View()), |
|
124 | + new \Symfony\Component\Console\Helper\QuestionHelper()) |
|
125 | + ); |
|
126 | + |
|
127 | + $application->add(new OC\Core\Command\Log\Manage(\OC::$server->getConfig())); |
|
128 | + $application->add(new OC\Core\Command\Log\File(\OC::$server->getConfig())); |
|
129 | + |
|
130 | + $view = new \OC\Files\View(); |
|
131 | + $util = new \OC\Encryption\Util( |
|
132 | + $view, |
|
133 | + \OC::$server->getUserManager(), |
|
134 | + \OC::$server->getGroupManager(), |
|
135 | + \OC::$server->getConfig() |
|
136 | + ); |
|
137 | + $application->add(new OC\Core\Command\Encryption\ChangeKeyStorageRoot( |
|
138 | + $view, |
|
139 | + \OC::$server->getUserManager(), |
|
140 | + \OC::$server->getConfig(), |
|
141 | + $util, |
|
142 | + new \Symfony\Component\Console\Helper\QuestionHelper() |
|
143 | + ) |
|
144 | + ); |
|
145 | + $application->add(new OC\Core\Command\Encryption\ShowKeyStorageRoot($util)); |
|
146 | + $application->add(new OC\Core\Command\Encryption\MigrateKeyStorage( |
|
147 | + $view, |
|
148 | + \OC::$server->getUserManager(), |
|
149 | + \OC::$server->getConfig(), |
|
150 | + $util, |
|
151 | + \OC::$server->getCrypto() |
|
152 | + ) |
|
153 | + ); |
|
154 | + |
|
155 | + $application->add(new OC\Core\Command\Maintenance\DataFingerprint(\OC::$server->getConfig(), new \OC\AppFramework\Utility\TimeFactory())); |
|
156 | + $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateDB(\OC::$server->getMimeTypeDetector(), \OC::$server->getMimeTypeLoader())); |
|
157 | + $application->add(new OC\Core\Command\Maintenance\Mimetype\UpdateJS(\OC::$server->getMimeTypeDetector())); |
|
158 | + $application->add(new OC\Core\Command\Maintenance\Mode(\OC::$server->getConfig())); |
|
159 | + $application->add(new OC\Core\Command\Maintenance\UpdateHtaccess()); |
|
160 | + $application->add(new OC\Core\Command\Maintenance\UpdateTheme(\OC::$server->getMimeTypeDetector(), \OC::$server->getMemCacheFactory())); |
|
161 | + |
|
162 | + $application->add(new OC\Core\Command\Upgrade(\OC::$server->getConfig(), \OC::$server->getLogger(), \OC::$server->query(\OC\Installer::class))); |
|
163 | + $application->add(new OC\Core\Command\Maintenance\Repair( |
|
164 | + new \OC\Repair([], \OC::$server->getEventDispatcher()), |
|
165 | + \OC::$server->getConfig(), |
|
166 | + \OC::$server->getEventDispatcher(), |
|
167 | + \OC::$server->getAppManager() |
|
168 | + )); |
|
169 | + |
|
170 | + $application->add(\OC::$server->query(\OC\Core\Command\Preview\Repair::class)); |
|
171 | + |
|
172 | + $application->add(new OC\Core\Command\User\Add(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
173 | + $application->add(new OC\Core\Command\User\Delete(\OC::$server->getUserManager())); |
|
174 | + $application->add(new OC\Core\Command\User\Disable(\OC::$server->getUserManager())); |
|
175 | + $application->add(new OC\Core\Command\User\Enable(\OC::$server->getUserManager())); |
|
176 | + $application->add(new OC\Core\Command\User\LastSeen(\OC::$server->getUserManager())); |
|
177 | + $application->add(\OC::$server->get(\OC\Core\Command\User\Report::class)); |
|
178 | + $application->add(new OC\Core\Command\User\ResetPassword(\OC::$server->getUserManager())); |
|
179 | + $application->add(new OC\Core\Command\User\Setting(\OC::$server->getUserManager(), \OC::$server->getConfig(), \OC::$server->getDatabaseConnection())); |
|
180 | + $application->add(new OC\Core\Command\User\ListCommand(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
181 | + $application->add(new OC\Core\Command\User\Info(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
182 | + $application->add(new OC\Core\Command\User\AddAppPassword(\OC::$server->get(\OCP\IUserManager::class), \OC::$server->get(\OC\Authentication\Token\IProvider::class), \OC::$server->get(\OCP\Security\ISecureRandom::class), \OC::$server->get(\OCP\Security\ICrypto::class))); |
|
183 | + |
|
184 | + $application->add(new OC\Core\Command\Group\Add(\OC::$server->getGroupManager())); |
|
185 | + $application->add(new OC\Core\Command\Group\Delete(\OC::$server->getGroupManager())); |
|
186 | + $application->add(new OC\Core\Command\Group\ListCommand(\OC::$server->getGroupManager())); |
|
187 | + $application->add(new OC\Core\Command\Group\AddUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
188 | + $application->add(new OC\Core\Command\Group\RemoveUser(\OC::$server->getUserManager(), \OC::$server->getGroupManager())); |
|
189 | + |
|
190 | + $application->add(new OC\Core\Command\Security\ListCertificates(\OC::$server->getCertificateManager(), \OC::$server->getL10N('core'))); |
|
191 | + $application->add(new OC\Core\Command\Security\ImportCertificate(\OC::$server->getCertificateManager())); |
|
192 | + $application->add(new OC\Core\Command\Security\RemoveCertificate(\OC::$server->getCertificateManager())); |
|
193 | + $application->add(new OC\Core\Command\Security\ResetBruteforceAttempts(\OC::$server->getBruteForceThrottler())); |
|
194 | 194 | } else { |
195 | - $application->add(\OC::$server->get(\OC\Core\Command\Maintenance\Install::class)); |
|
195 | + $application->add(\OC::$server->get(\OC\Core\Command\Maintenance\Install::class)); |
|
196 | 196 | } |
@@ -45,93 +45,93 @@ |
||
45 | 45 | |
46 | 46 | class AddAppPassword extends Command { |
47 | 47 | |
48 | - /** @var IUserManager */ |
|
49 | - protected $userManager; |
|
50 | - /** @var IProvider */ |
|
51 | - protected $tokenProvider; |
|
52 | - /** @var ISecureRandom */ |
|
53 | - private $random; |
|
54 | - /** @var ICrypto */ |
|
55 | - private $crypto; |
|
56 | - |
|
57 | - public function __construct(IUserManager $userManager, |
|
58 | - IProvider $tokenProvider, |
|
59 | - ISecureRandom $random, |
|
60 | - ICrypto $crypto) { |
|
61 | - $this->tokenProvider = $tokenProvider; |
|
62 | - $this->userManager = $userManager; |
|
63 | - $this->random = $random; |
|
64 | - $this->crypto = $crypto; |
|
65 | - parent::__construct(); |
|
66 | - } |
|
67 | - |
|
68 | - protected function configure() { |
|
69 | - $this |
|
70 | - ->setName('user:add-app-password') |
|
71 | - ->setDescription('Add app password for the named user') |
|
72 | - ->addArgument( |
|
73 | - 'user', |
|
74 | - InputArgument::REQUIRED, |
|
75 | - 'Username to add app password for' |
|
76 | - ) |
|
77 | - ->addOption( |
|
78 | - 'password-from-env', |
|
79 | - null, |
|
80 | - InputOption::VALUE_NONE, |
|
81 | - 'read password from environment variable NC_PASS/OC_PASS' |
|
82 | - ) |
|
83 | - ; |
|
84 | - } |
|
85 | - |
|
86 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
87 | - $username = $input->getArgument('user'); |
|
88 | - |
|
89 | - $user = $this->userManager->get($username); |
|
90 | - if (is_null($user)) { |
|
91 | - $output->writeln('<error>User does not exist</error>'); |
|
92 | - return 1; |
|
93 | - } |
|
94 | - |
|
95 | - if ($input->getOption('password-from-env')) { |
|
96 | - $password = getenv('NC_PASS') ?? getenv('OC_PASS'); |
|
97 | - if (!$password) { |
|
98 | - $output->writeln('<error>--password-from-env given, but NC_PASS is empty!</error>'); |
|
99 | - return 1; |
|
100 | - } |
|
101 | - } elseif ($input->isInteractive()) { |
|
102 | - /** @var QuestionHelper $helper */ |
|
103 | - $helper = $this->getHelper('question'); |
|
104 | - |
|
105 | - $question = new Question('Enter the user password: '); |
|
106 | - $question->setHidden(true); |
|
107 | - $password = $helper->ask($input, $output, $question); |
|
108 | - |
|
109 | - if ($password === null) { |
|
110 | - $output->writeln("<error>Password cannot be empty!</error>"); |
|
111 | - return 1; |
|
112 | - } |
|
113 | - } else { |
|
114 | - $output->writeln("<error>Interactive input or --password-from-env is needed for entering a new password!</error>"); |
|
115 | - return 1; |
|
116 | - } |
|
117 | - |
|
118 | - $output->writeln('<info>The password is not validated so what you provide is what gets recorded in the token</info>'); |
|
119 | - |
|
120 | - |
|
121 | - $token = $this->random->generate(72, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS); |
|
122 | - $this->tokenProvider->generateToken( |
|
123 | - $token, |
|
124 | - $user->getUID(), |
|
125 | - $user->getDisplayName(), |
|
126 | - $password, |
|
127 | - 'cli', |
|
128 | - IToken::PERMANENT_TOKEN, |
|
129 | - IToken::DO_NOT_REMEMBER |
|
130 | - ); |
|
131 | - |
|
132 | - $output->writeln('app password:'); |
|
133 | - $output->writeln($token); |
|
134 | - |
|
135 | - return 0; |
|
136 | - } |
|
48 | + /** @var IUserManager */ |
|
49 | + protected $userManager; |
|
50 | + /** @var IProvider */ |
|
51 | + protected $tokenProvider; |
|
52 | + /** @var ISecureRandom */ |
|
53 | + private $random; |
|
54 | + /** @var ICrypto */ |
|
55 | + private $crypto; |
|
56 | + |
|
57 | + public function __construct(IUserManager $userManager, |
|
58 | + IProvider $tokenProvider, |
|
59 | + ISecureRandom $random, |
|
60 | + ICrypto $crypto) { |
|
61 | + $this->tokenProvider = $tokenProvider; |
|
62 | + $this->userManager = $userManager; |
|
63 | + $this->random = $random; |
|
64 | + $this->crypto = $crypto; |
|
65 | + parent::__construct(); |
|
66 | + } |
|
67 | + |
|
68 | + protected function configure() { |
|
69 | + $this |
|
70 | + ->setName('user:add-app-password') |
|
71 | + ->setDescription('Add app password for the named user') |
|
72 | + ->addArgument( |
|
73 | + 'user', |
|
74 | + InputArgument::REQUIRED, |
|
75 | + 'Username to add app password for' |
|
76 | + ) |
|
77 | + ->addOption( |
|
78 | + 'password-from-env', |
|
79 | + null, |
|
80 | + InputOption::VALUE_NONE, |
|
81 | + 'read password from environment variable NC_PASS/OC_PASS' |
|
82 | + ) |
|
83 | + ; |
|
84 | + } |
|
85 | + |
|
86 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
87 | + $username = $input->getArgument('user'); |
|
88 | + |
|
89 | + $user = $this->userManager->get($username); |
|
90 | + if (is_null($user)) { |
|
91 | + $output->writeln('<error>User does not exist</error>'); |
|
92 | + return 1; |
|
93 | + } |
|
94 | + |
|
95 | + if ($input->getOption('password-from-env')) { |
|
96 | + $password = getenv('NC_PASS') ?? getenv('OC_PASS'); |
|
97 | + if (!$password) { |
|
98 | + $output->writeln('<error>--password-from-env given, but NC_PASS is empty!</error>'); |
|
99 | + return 1; |
|
100 | + } |
|
101 | + } elseif ($input->isInteractive()) { |
|
102 | + /** @var QuestionHelper $helper */ |
|
103 | + $helper = $this->getHelper('question'); |
|
104 | + |
|
105 | + $question = new Question('Enter the user password: '); |
|
106 | + $question->setHidden(true); |
|
107 | + $password = $helper->ask($input, $output, $question); |
|
108 | + |
|
109 | + if ($password === null) { |
|
110 | + $output->writeln("<error>Password cannot be empty!</error>"); |
|
111 | + return 1; |
|
112 | + } |
|
113 | + } else { |
|
114 | + $output->writeln("<error>Interactive input or --password-from-env is needed for entering a new password!</error>"); |
|
115 | + return 1; |
|
116 | + } |
|
117 | + |
|
118 | + $output->writeln('<info>The password is not validated so what you provide is what gets recorded in the token</info>'); |
|
119 | + |
|
120 | + |
|
121 | + $token = $this->random->generate(72, ISecureRandom::CHAR_UPPER.ISecureRandom::CHAR_LOWER.ISecureRandom::CHAR_DIGITS); |
|
122 | + $this->tokenProvider->generateToken( |
|
123 | + $token, |
|
124 | + $user->getUID(), |
|
125 | + $user->getDisplayName(), |
|
126 | + $password, |
|
127 | + 'cli', |
|
128 | + IToken::PERMANENT_TOKEN, |
|
129 | + IToken::DO_NOT_REMEMBER |
|
130 | + ); |
|
131 | + |
|
132 | + $output->writeln('app password:'); |
|
133 | + $output->writeln($token); |
|
134 | + |
|
135 | + return 0; |
|
136 | + } |
|
137 | 137 | } |