From a77bae9e44e709e5d025d45685e592bb01a0e794 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Mon, 28 Jun 2021 16:41:56 +1200 Subject: [PATCH] ENH Remove duplicate permission check --- _legacy/GraphQL/FolderTypeCreator.php | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/_legacy/GraphQL/FolderTypeCreator.php b/_legacy/GraphQL/FolderTypeCreator.php index 8d1c81793..dcd692df5 100644 --- a/_legacy/GraphQL/FolderTypeCreator.php +++ b/_legacy/GraphQL/FolderTypeCreator.php @@ -208,26 +208,7 @@ public function resolveChildrenConnection( }); } - // Filter by permission - // DataQuery::column ignores surrogate sorting fields - // see https://github.com/silverstripe/silverstripe-framework/issues/8926 - // the following line is a workaround for `$ids = $list->column('ID');` - $ids = $list->dataQuery()->execute()->column('ID'); - - $permissionChecker = File::singleton()->getPermissionChecker(); - $canViewIDs = array_keys(array_filter($permissionChecker->canViewMultiple( - $ids, - $context['currentUser'] - ))); - // Filter by visible IDs (or force empty set if none are visible) - // Remove the limit as it no longer applies. We've already filtered down to the exact - // IDs we need. - $canViewList = $list->filter('ID', $canViewIDs ?: 0) - ->limit(null); - - $result = $childrenConnection->resolveList($list, $args); - - return $result; + return $childrenConnection->resolveList($list, $args); } /**