From 474571f2ebbc73ba5ccce1677dd1b60b57b82e74 Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Thu, 2 May 2019 14:13:52 +0300 Subject: [PATCH] Fixed admin not detecting any existing users when Flex users are being used --- CHANGELOG.md | 1 + classes/admin.php | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b0202960..72e37ff1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Fixed admin cache to detect moved and deleted pages * Fixed avatar URLs with `?` in them being broken * Fixed issue saving page with language that was not exactly `2` or `5` chars long [#1667](https://github.com/getgrav/grav-plugin-admin/issues/1667) + * Fixed admin not detecting any existing users when Flex users are being used # v1.9.3 ## 04/22/2019 diff --git a/classes/admin.php b/classes/admin.php index d250e9ab..66c3aabd 100644 --- a/classes/admin.php +++ b/classes/admin.php @@ -480,11 +480,16 @@ class Admin */ public static function doAnyUsersExist() { - // check for existence of a user account + $accounts = Grav::instance()['accounts'] ?? null; + if ($accounts instanceof \Countable) { + return $accounts->count() > 0; + } + + // TODO: remove old way to check for existence of a user account (Grav < v1.6.9) $account_dir = $file_path = Grav::instance()['locator']->findResource('account://'); $user_check = glob($account_dir . '/*.yaml'); - return $user_check ? true : false; + return $user_check; } /**