From a4beb9b8bdc6f5233d6944404e5977036ecf8eb9 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Wed, 15 Dec 2021 18:00:27 +0200 Subject: [PATCH] Fixed `UserObject::$authorizeCallable` binding to the user object --- CHANGELOG.md | 1 + system/src/Grav/Common/Flex/Types/Users/UserObject.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 822d9a6cc..1736bc153 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * Block `.json` files in web server configs * Disabled pretty debug info for Flex as it slows down Twig rendering * Fixed Twig being very slow when template overrides do not exist + * Fixed `UserObject::$authorizeCallable` binding to the user object # v1.7.25 ## 11/16/2021 diff --git a/system/src/Grav/Common/Flex/Types/Users/UserObject.php b/system/src/Grav/Common/Flex/Types/Users/UserObject.php index b89997ac7..77d49528c 100644 --- a/system/src/Grav/Common/Flex/Types/Users/UserObject.php +++ b/system/src/Grav/Common/Flex/Types/Users/UserObject.php @@ -284,8 +284,8 @@ class UserObject extends FlexObject implements UserInterface, Countable // Check custom application access. $authorizeCallable = static::$authorizeCallable; if ($authorizeCallable instanceof Closure) { - $authorizeCallable->bindTo($this); - $authorized = $authorizeCallable($action, $scope); + $callable = $authorizeCallable->bindTo($this, $this); + $authorized = $callable($action, $scope); if (is_bool($authorized)) { return $authorized; }