Skip to content

fix: alternative UI permission fix for bounty admin buttons (#238)#242

Closed
ZackaryShen wants to merge 1 commit intoalgora-io:mainfrom
ZackaryShen:fix/238-alternative-ui-permission-check
Closed

fix: alternative UI permission fix for bounty admin buttons (#238)#242
ZackaryShen wants to merge 1 commit intoalgora-io:mainfrom
ZackaryShen:fix/238-alternative-ui-permission-check

Conversation

@ZackaryShen
Copy link
Copy Markdown

Summary

Alternative fix for #238 — adds :if={@current_user_role in [:admin, :mod]} to each admin button individually, rather than wrapping the parent div.

Changes

  • lib/algora_web/live/org/bounties_live.ex: +2 lines
  • Edit Amount button: now has :if={@current_user_role in [:admin, :mod]}
  • Delete button: now has :if={@current_user_role in [:admin, :mod]}

Why This Approach

  1. Per-button explicit check: Each button independently verifies permissions, matching the backend authorization in handle_event
  2. No parent-div dependency: If the parent div logic changes, button visibility is still correct
  3. Auditability: Each conditional is independently reviewable

Testing

Backend authorization confirmed working (unauthorized clicks return error toast). No Elixir environment available in current context — please test locally.

Closes #238

Alternative fix for #238 — adds :if={@current_user_role in [:admin, :mod]}
to each admin button individually instead of wrapping the parent div.

This ensures the permission check is explicit at the button level, matching
the backend authorization logic in handle_event handlers.
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


root seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@ZackaryShen
Copy link
Copy Markdown
Author

Also marking as ready for review. The fix adds explicit per-button permission checks matching the backend handler guards. Happy to discuss the approach.

@ZackaryShen ZackaryShen closed this by deleting the head repository Apr 27, 2026
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.

[UI Bug] Unauthorized 'Edit' and 'Delete' buttons visible on /bounties page

2 participants