diff --git a/lib/philomena/users/ability.ex b/lib/philomena/users/ability.ex index f7923a91..2a3efbc5 100644 --- a/lib/philomena/users/ability.ex +++ b/lib/philomena/users/ability.ex @@ -121,6 +121,9 @@ defimpl Canada.Can, for: [Atom, Philomena.Users.User] do # Revert tag changes def can?(%User{role: "moderator"}, :revert, TagChange), do: true + # Manage commissions + def can?(%User{role: "moderator"}, _action, %Commission{}), do: true + # And some privileged moderators can... # Manage site notices diff --git a/lib/philomena_web/controllers/profile/commission_controller.ex b/lib/philomena_web/controllers/profile/commission_controller.ex index adac762d..2a74da70 100644 --- a/lib/philomena_web/controllers/profile/commission_controller.ex +++ b/lib/philomena_web/controllers/profile/commission_controller.ex @@ -136,6 +136,7 @@ defmodule PhilomenaWeb.Profile.CommissionController do case conn.assigns.current_user do %{id: ^user_id} -> conn + %{role: role} when role in ["admin", "moderator"] -> conn _other -> PhilomenaWeb.NotAuthorizedPlug.call(conn) end end