Remove function superuser?

Everything now happens with privileged?/2
This commit is contained in:
Ilja 2022-06-18 10:55:45 +02:00
parent eab13fed3e
commit a1c8aa4721
2 changed files with 0 additions and 33 deletions

View file

@ -371,11 +371,6 @@ defmodule Pleroma.User do
defp privileged_for?(_, _, _), do: false defp privileged_for?(_, _, _), do: false
@spec superuser?(User.t()) :: boolean()
def superuser?(%User{local: true, is_admin: true}), do: true
def superuser?(%User{local: true, is_moderator: true}), do: true
def superuser?(_), do: false
@spec invisible?(User.t()) :: boolean() @spec invisible?(User.t()) :: boolean()
def invisible?(%User{invisible: true}), do: true def invisible?(%User{invisible: true}), do: true
def invisible?(_), do: false def invisible?(_), do: false

View file

@ -1918,34 +1918,6 @@ defmodule Pleroma.UserTest do
end end
end end
describe "superuser?/1" do
test "returns false for unprivileged users" do
user = insert(:user, local: true)
refute User.superuser?(user)
end
test "returns false for remote users" do
user = insert(:user, local: false)
remote_admin_user = insert(:user, local: false, is_admin: true)
refute User.superuser?(user)
refute User.superuser?(remote_admin_user)
end
test "returns true for local moderators" do
user = insert(:user, local: true, is_moderator: true)
assert User.superuser?(user)
end
test "returns true for local admins" do
user = insert(:user, local: true, is_admin: true)
assert User.superuser?(user)
end
end
describe "invisible?/1" do describe "invisible?/1" do
test "returns true for an invisible user" do test "returns true for an invisible user" do
user = insert(:user, local: true, invisible: true) user = insert(:user, local: true, invisible: true)