Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 11, 2025

Authorization checks were comparing incompatible types: $post->getAuthor() (User object) with $user->getUsername() (string).

Changes

  • Fixed three authorization checks in PostController (edit form, update action, delete action)
  • Changed comparison from $post->getAuthor() !== $user->getUsername() to $post->getAuthorId() !== $user->getId()
// Before: comparing User object with string
if( !$user->isAdmin() && !$user->isEditor() && $post->getAuthor() !== $user->getUsername() )

// After: comparing integer IDs
if( !$user->isAdmin() && !$user->isEditor() && $post->getAuthorId() !== $user->getId() )

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 11, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: ljonesfl <1099983+ljonesfl@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on service architecture implementation Fix type mismatch in PostController authorization checks Nov 11, 2025
Copilot finished work on behalf of ljonesfl November 11, 2025 03:14
Copilot AI requested a review from ljonesfl November 11, 2025 03:14
@ljonesfl ljonesfl marked this pull request as ready for review November 11, 2025 03:21
@ljonesfl ljonesfl merged commit c3a877e into feature/service-architecture Nov 11, 2025
2 checks passed
@ljonesfl ljonesfl deleted the copilot/sub-pr-6-another-one branch November 11, 2025 03:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants