fix permission error

This commit is contained in:
byte[] 2020-03-05 02:04:21 -05:00
parent 67ac0318f7
commit 37a2d014cd
2 changed files with 2 additions and 1 deletions

View file

@ -38,6 +38,7 @@ defimpl Canada.Can, for: [Atom, Philomena.Users.User] do
# Show details of profiles and view user list
def can?(%User{role: "moderator"}, :show_details, %User{}), do: true
def can?(%User{role: "moderator"}, :edit_description, %User{}), do: true
def can?(%User{role: "moderator"}, :index, User), do: true
# View filters

View file

@ -6,7 +6,7 @@ defmodule PhilomenaWeb.Profile.DescriptionController do
plug PhilomenaWeb.FilterBannedUsersPlug
plug PhilomenaWeb.CanaryMapPlug, edit: :edit_description, update: :edit_description
plug :load_resource, model: User, id_name: "profile_id", id_field: "slug", persisted: true
plug :load_and_authorize_resource, model: User, id_name: "profile_id", id_field: "slug", persisted: true
def edit(conn, _params) do
changeset = Users.change_user(conn.assigns.user)