diff --git a/src/Auth/AuthInfo.php b/src/Auth/AuthInfo.php index 8c5a84ed..f97f240b 100644 --- a/src/Auth/AuthInfo.php +++ b/src/Auth/AuthInfo.php @@ -51,7 +51,7 @@ class AuthInfo { get => $this->sessionInfo?->id; } - public bool $isImpersonating { + public bool $impersonating { get => $this->realUserInfo !== null; } diff --git a/src/Messages/MessagesRoutes.php b/src/Messages/MessagesRoutes.php index b2b794f1..fec94943 100644 --- a/src/Messages/MessagesRoutes.php +++ b/src/Messages/MessagesRoutes.php @@ -45,7 +45,7 @@ class MessagesRoutes implements RouteHandler, UrlSource { return 401; // do not allow access to PMs when impersonating in production mode - if(!MSZ_DEBUG && $this->authInfo->isImpersonating) + if(!MSZ_DEBUG && $this->authInfo->impersonating) return 403; $globalPerms = $this->authInfo->getPerms('global'); diff --git a/src/OAuth2/OAuth2WebRoutes.php b/src/OAuth2/OAuth2WebRoutes.php index 62909582..94285413 100644 --- a/src/OAuth2/OAuth2WebRoutes.php +++ b/src/OAuth2/OAuth2WebRoutes.php @@ -215,7 +215,7 @@ final class OAuth2WebRoutes implements RouteHandler { 'scope' => $scope, ]; - if($this->authInfo->isImpersonating) + if($this->authInfo->impersonating) $result['user']['guise'] = [ 'name' => $this->authInfo->realUserInfo->name, 'colour' => (string)$this->usersCtx->getUserColour($this->authInfo->realUserInfo), @@ -403,7 +403,7 @@ final class OAuth2WebRoutes implements RouteHandler { ], ]; - if($this->authInfo->isImpersonating) + if($this->authInfo->impersonating) $result['user']['guise'] = [ 'name' => $this->authInfo->realUserInfo->name, 'colour' => (string)$this->usersCtx->getUserColour($this->authInfo->realUserInfo), diff --git a/templates/_layout/header.twig b/templates/_layout/header.twig index 87549d97..62fe99ce 100644 --- a/templates/_layout/header.twig +++ b/templates/_layout/header.twig @@ -1,7 +1,7 @@ {% from 'macros.twig' import avatar %} {% from '_layout/input.twig' import input_checkbox_raw %} -{% if globals.auth_info.isImpersonating %} +{% if globals.auth_info.impersonating %} {% set real_user_info = globals.auth_info.realUserInfo %} <div class="impersonate"> <div class="impersonate-content">