mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user