mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
fix(mqtt): resolve getProjectDB via the container in the SUBSCRIBE authorizer
The DI refactor moved the broker's DB/cache resolvers onto the container but left the authorizer closure calling the removed global getProjectDB(), so every SUBSCRIBE threw "Call to undefined function getProjectDB()" before the SUBACK (CONNECT was unaffected as it only uses the authenticator).
This commit is contained in:
1 parent
72e5465d3b
commit
8d5e92e288
1 file changed
+4
-3
@@ -108,8 +108,8 @@ return function (Container $container): void {
|
||||
};
|
||||
}, []);
|
||||
|
||||
$container->set('authorizer', function () use ($getProject): callable {
|
||||
return function (array $identity, string $topic) use ($getProject): bool {
|
||||
$container->set('authorizer', function () use ($getProject, $container): callable {
|
||||
return function (array $identity, string $topic) use ($getProject, $container): bool {
|
||||
$userId = $identity['userId'] ?? '';
|
||||
$projectId = $identity['projectId'] ?? '';
|
||||
if ($userId === '' || $projectId === '') {
|
||||
@@ -123,7 +123,8 @@ return function (Container $container): void {
|
||||
return false;
|
||||
}
|
||||
|
||||
$dbForProject = getProjectDB($project);
|
||||
$getProjectDB = $container->get('getProjectDB');
|
||||
$dbForProject = $getProjectDB($project);
|
||||
$dbForProject->setAuthorization($authorization);
|
||||
$user = $authorization->skip(fn () => $dbForProject->getDocument('users', $userId));
|
||||
|
||||
|
||||
Reference in new issue
Block a user