Allow moderators to edit commissions

Fixes #194
This commit is contained in:
Raptorshy 2020-09-14 20:39:58 -07:00 committed by byte[]
parent d76f1d6fdb
commit 9d0d622fbd
2 changed files with 4 additions and 0 deletions

View file

@ -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

View file

@ -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