Skip to content

feat: allow authors to edit their own blogs and resources - #393

Merged
trtajim merged 5 commits into
mainfrom
allow-authors-to-edit-own-blogs
Oct 8, 2026
Merged

trtajim merged 5 commits into
mainfrom
allow-authors-to-edit-own-blogs

Conversation

@trtajim

@trtajim trtajim commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Summary of Changes

  • BlogPolicy: Created app/Policies/BlogPolicy.php where update allows either the blog author (user_id === blog.user_id) or users holding the global edit blogs permission. Deleting remains strictly restricted to holders of the delete blogs permission.
  • Routes & Authorization: Updated blog edit/update routes in routes/admin.php to use can:update,blog middleware instead of coarse permission:edit blogs.
  • Form Request & Controller: Enforced policy authorization checks in UpdateBlogRequest and AdminBlogController.
  • Frontend UI: Updated resources/js/components/BlogRow.vue to display the edit action if the user is the author or holds edit blogs, while keeping deletion strictly gated by delete blogs.

Summary by CodeRabbit

  • Access Control
    • Blog owners can edit their blogs, while users with the relevant editing permission retain access.
    • Resource owners can edit resources unless the resource’s node is frozen; users with the editing permission retain access when it isn’t frozen.
    • Blog and resource edit options now reflect these access rules. Resource deletion remains unavailable when frozen.

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Repository: hscstack/platform/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e685d082-144d-4180-a387-772d63e0fc61
📥 Commits

Reviewing files that changed from the base of the PR and between e061dab and fc9e510.

📒 Files selected for processing (5)
  • app/Policies/BlogPolicy.php
  • app/Policies/ResourcePolicy.php
  • resources/js/components/BlogRow.vue
  • resources/js/components/admin/ResourceRow.vue
  • routes/admin.php
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@trtajim trtajim changed the title feat(blogs): allow authors to edit their own blogs feat: allow authors to edit their own blogs and resources Oct 8, 2026
@trtajim
trtajim merged commit 96d9bc0 into main Oct 8, 2026
5 of 6 checks passed
@trtajim
trtajim deleted the allow-authors-to-edit-own-blogs branch October 8, 2026 11:28
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.

1 participant