From a50f9e40e98b4e1dc0a2db5ad7f76c5a1b7d083a Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Thu, 9 Nov 2023 10:12:26 +1300 Subject: [PATCH] FIX Limit Member map to 100 --- code/Forms/AssetFormFactory.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/code/Forms/AssetFormFactory.php b/code/Forms/AssetFormFactory.php index dbb052556..998926b18 100644 --- a/code/Forms/AssetFormFactory.php +++ b/code/Forms/AssetFormFactory.php @@ -368,7 +368,16 @@ protected function getFormFieldSecurityTab($record, $context = []) // No "Anyone" editors option $editorsOptionsField = $viewersOptionsField; unset($editorsOptionsField[InheritedPermissions::ANYONE]); - $membersMap = Member::get()->map('ID', 'Name'); + + // $membersMap is limited to 100 records specifically so that it does not crash the front-end + // if the website has a large number of Members, which is likely to happen if the website also + // uses the Member table for non-cms public users + // This limit should be removed if the ListboxField front-end component is switched out or + // modified so that it does not load all users at once and instead uses XHR to fetch a subset + // of users based on what the user types in + $membersMap = Member::get() + ->limit(100) + ->map('ID', 'Name'); return Tab::create( 'Permissions',