From d1b2b0e10b488b1e1083879ecf488a236a71942c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 11 Nov 2025 03:08:19 +0000 Subject: [PATCH 1/2] Initial plan From 5617a5733f3192bed021d203d434bcedd92d0afe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 11 Nov 2025 03:13:04 +0000 Subject: [PATCH 2/2] Fix authorization check type mismatch in PostController Co-authored-by: ljonesfl <1099983+ljonesfl@users.noreply.github.com> --- src/Cms/Controllers/Admin/PostController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Cms/Controllers/Admin/PostController.php b/src/Cms/Controllers/Admin/PostController.php index 17383e3..b23aa4f 100644 --- a/src/Cms/Controllers/Admin/PostController.php +++ b/src/Cms/Controllers/Admin/PostController.php @@ -241,7 +241,7 @@ public function edit( array $parameters ): string } // Check permissions - if( !$user->isAdmin() && !$user->isEditor() && $post->getAuthor() !== $user->getUsername() ) + if( !$user->isAdmin() && !$user->isEditor() && $post->getAuthorId() !== $user->getId() ) { throw new \RuntimeException( 'Unauthorized to edit this post' ); } @@ -298,7 +298,7 @@ public function update( array $parameters ): string } // Check permissions - if( !$user->isAdmin() && !$user->isEditor() && $post->getAuthor() !== $user->getUsername() ) + if( !$user->isAdmin() && !$user->isEditor() && $post->getAuthorId() !== $user->getId() ) { throw new \RuntimeException( 'Unauthorized to edit this post' ); } @@ -367,7 +367,7 @@ public function destroy( array $parameters ): string } // Check permissions - if( !$user->isAdmin() && !$user->isEditor() && $post->getAuthor() !== $user->getUsername() ) + if( !$user->isAdmin() && !$user->isEditor() && $post->getAuthorId() !== $user->getId() ) { $sessionManager->flash( 'error', 'Unauthorized to delete this post' ); header( 'Location: /admin/posts' );