fix: convert static isPrivileged() call to instance method in error handler

The error handler in general.php was calling User::isPrivileged()
statically, but the method was converted to an instance method.
This caused a fatal error on every request.

https://claude.ai/code/session_01JLPDurUgyj7qViA8JqQFTH
This commit is contained in:
Claude
2026-03-17 04:19:40 +00:00
parent 5c47d4f48b
commit cfc325635d
+2 -3
View File
@@ -1270,15 +1270,14 @@ Http::error()
* If not a publishable error, track usage stats. Publishable errors are >= 500 or those explicitly marked as publish=true in errors.php
*/
if (!$publish && $project->getId() !== 'console') {
$userClass = DBUser::class;
$errorUser = new DBUser();
try {
/** @var DBUser $errorUser */
$errorUser = $utopia->getResource('user');
$userClass = $errorUser::class;
} catch (\Throwable) {
// User resource may not be available in error context
}
if (!$userClass::isPrivileged($authorization->getRoles())) {
if (!$errorUser->isPrivileged($authorization->getRoles())) {
$bus->dispatch(new RequestCompleted(
project: $project->getArrayCopy(),
request: $request,