From 5d89e6dcf42c8166ebf841e8dfb696cf050c01e6 Mon Sep 17 00:00:00 2001 From: Dreytac Date: Mon, 20 Apr 2026 12:28:54 +1000 Subject: [PATCH] Implement permission check on pages used in link lists. --- index.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/index.php b/index.php index 23779af..2b63ada 100644 --- a/index.php +++ b/index.php @@ -91,6 +91,22 @@ Kirby::plugin( $pages = site()->index(true)->filterBy("linkLocation", $linkLocation); foreach ($pages as $page) { + if (kirby()->plugin("hobbyhome/permissions")) { + // Hacky way of allowing us to run a hook multiple times from within another hook. + $events = kirby()->events; + call_user_func( + \Closure::bind( + function () use ($events) { + unset($events->processed["permissions.page:check"]); + }, null, $events + ) + ); + + if (!$page->hasPerm()) { + continue; + } + } + if ($page->isDraft() && !($user = kirby()->user() and $user->role()->isAdmin())) { continue; }