mirror of
https://github.com/philomena-dev/philomena.git
synced 2025-01-20 06:37:59 +01:00
ensure moderators can see duplicate report tab
This commit is contained in:
parent
2c1725f20a
commit
ca3afb26fd
2 changed files with 6 additions and 2 deletions
|
@ -161,7 +161,7 @@ defmodule Philomena.DuplicateReports do
|
|||
end
|
||||
|
||||
def count_duplicate_reports(user) do
|
||||
if Canada.Can.can?(user, :edit, DuplicateReport) do
|
||||
if Canada.Can.can?(user, :index, DuplicateReport) do
|
||||
DuplicateReport
|
||||
|> where(state: "open")
|
||||
|> Repo.aggregate(:count, :id)
|
||||
|
|
|
@ -42,7 +42,10 @@ defimpl Canada.Can, for: [Atom, Philomena.Users.User] do
|
|||
# View IP addresses and fingerprints
|
||||
def can?(%User{role: "moderator"}, :show, :ip_address), do: true
|
||||
|
||||
# View reports
|
||||
# Manage duplicate reports
|
||||
def can?(%User{role: "moderator"}, :index, DuplicateReport), do: true
|
||||
|
||||
# Manage reports
|
||||
def can?(%User{role: "moderator"}, :index, Report), do: true
|
||||
def can?(%User{role: "moderator"}, :show, %Report{}), do: true
|
||||
def can?(%User{role: "moderator"}, :edit, %Report{}), do: true
|
||||
|
@ -64,6 +67,7 @@ defimpl Canada.Can, for: [Atom, Philomena.Users.User] do
|
|||
def can?(%User{role: "assistant", role_map: %{"Image" => "moderator"}}, :edit, %Image{}), do: true
|
||||
|
||||
# Dupe assistant actions
|
||||
def can?(%User{role: "assistant", role_map: %{"DuplicateReport" => "moderator"}}, :index, DuplicateReport), do: true
|
||||
def can?(%User{role: "assistant", role_map: %{"DuplicateReport" => "moderator"}}, :edit, %DuplicateReport{}), do: true
|
||||
def can?(%User{role: "assistant", role_map: %{"DuplicateReport" => "moderator"}}, :show, %Image{}), do: true
|
||||
def can?(%User{role: "assistant", role_map: %{"DuplicateReport" => "moderator"}}, :edit, %Image{}), do: true
|
||||
|
|
Loading…
Reference in a new issue