|
41 | 41 | // require controllers after overwriting runtimes |
42 | 42 | require_once __DIR__ . '/controllers/general.php'; |
43 | 43 |
|
| 44 | +Authorization::disable(); |
| 45 | + |
44 | 46 | CLI::setResource('register', fn () => $register); |
45 | 47 |
|
46 | 48 | CLI::setResource('cache', function ($pools) { |
|
58 | 60 | return $register->get('pools'); |
59 | 61 | }, ['register']); |
60 | 62 |
|
61 | | -CLI::setResource('authorization', function () { |
62 | | - $authorization = new Authorization(); |
63 | | - $authorization->disable(); |
64 | | - return $authorization; |
65 | | -}, []); |
66 | | - |
67 | | -CLI::setResource('dbForPlatform', function ($pools, $cache, $authorization) { |
| 63 | +CLI::setResource('dbForPlatform', function ($pools, $cache) { |
68 | 64 | $sleep = 3; |
69 | 65 | $maxAttempts = 5; |
70 | 66 | $attempts = 0; |
|
78 | 74 | $dbForPlatform = new Database($adapter, $cache); |
79 | 75 |
|
80 | 76 | $dbForPlatform |
81 | | - ->setAuthorization($authorization) |
82 | 77 | ->setNamespace('_console') |
83 | 78 | ->setMetadata('host', \gethostname()) |
84 | 79 | ->setMetadata('project', 'console'); |
|
104 | 99 | } |
105 | 100 |
|
106 | 101 | return $dbForPlatform; |
107 | | -}, ['pools', 'cache', 'authorization']); |
| 102 | +}, ['pools', 'cache']); |
108 | 103 |
|
109 | 104 | CLI::setResource('console', function () { |
110 | 105 | return new Document(Config::getParam('console')); |
|
115 | 110 | fn () => fn (Document $project, string $resourceType, ?string $resourceId) => false |
116 | 111 | ); |
117 | 112 |
|
118 | | -CLI::setResource('getProjectDB', function (Group $pools, Database $dbForPlatform, $cache, $authorization) { |
| 113 | +CLI::setResource('getProjectDB', function (Group $pools, Database $dbForPlatform, $cache) { |
119 | 114 | $databases = []; // TODO: @Meldiron This should probably be responsibility of utopia-php/pools |
120 | 115 |
|
121 | | - return function (Document $project) use ($pools, $dbForPlatform, $cache, $authorization, &$databases) { |
| 116 | + return function (Document $project) use ($pools, $dbForPlatform, $cache, &$databases) { |
122 | 117 | if ($project->isEmpty() || $project->getId() === 'console') { |
123 | 118 | return $dbForPlatform; |
124 | 119 | } |
|
151 | 146 |
|
152 | 147 | $adapter = new DatabasePool($pools->get($dsn->getHost())); |
153 | 148 | $database = new Database($adapter, $cache); |
154 | | - |
155 | 149 | $databases[$dsn->getHost()] = $database; |
156 | 150 | $sharedTables = \explode(',', System::getEnv('_APP_DATABASE_SHARED_TABLES', '')); |
157 | 151 |
|
|
168 | 162 | } |
169 | 163 |
|
170 | 164 | $database |
171 | | - ->setAuthorization($authorization) |
172 | 165 | ->setMetadata('host', \gethostname()) |
173 | 166 | ->setMetadata('project', $project->getId()); |
174 | 167 |
|
175 | 168 | return $database; |
176 | 169 | }; |
177 | | -}, ['pools', 'dbForPlatform', 'cache', 'authorization']); |
| 170 | +}, ['pools', 'dbForPlatform', 'cache']); |
178 | 171 |
|
179 | | -CLI::setResource('getLogsDB', function (Group $pools, Cache $cache, Authorization $authorization) { |
| 172 | +CLI::setResource('getLogsDB', function (Group $pools, Cache $cache) { |
180 | 173 | $database = null; |
181 | 174 |
|
182 | | - return function (?Document $project = null) use ($pools, $cache, $database, $authorization) { |
| 175 | + return function (?Document $project = null) use ($pools, $cache, $database) { |
183 | 176 | if ($database !== null && $project !== null && !$project->isEmpty() && $project->getId() !== 'console') { |
184 | 177 | $database->setTenant((int)$project->getSequence()); |
185 | 178 | return $database; |
|
189 | 182 | $database = new Database($adapter, $cache); |
190 | 183 |
|
191 | 184 | $database |
192 | | - ->setAuthorization($authorization) |
193 | 185 | ->setSharedTables(true) |
194 | 186 | ->setNamespace('logsV1') |
195 | 187 | ->setTimeout(APP_DATABASE_TIMEOUT_MILLISECONDS_TASK) |
|
202 | 194 |
|
203 | 195 | return $database; |
204 | 196 | }; |
205 | | -}, ['pools', 'cache', 'authorization']); |
| 197 | +}, ['pools', 'cache']); |
206 | 198 | CLI::setResource('publisher', function (Group $pools) { |
207 | 199 | return new BrokerPool(publisher: $pools->get('publisher')); |
208 | 200 | }, ['pools']); |
|
0 commit comments