mirror of
https://git.pleroma.social/pleroma/pleroma.git
synced 2024-11-05 16:39:47 +00:00
Remove function superuser?
Everything now happens with privileged?/2
This commit is contained in:
parent
eab13fed3e
commit
a1c8aa4721
2 changed files with 0 additions and 33 deletions
|
@ -371,11 +371,6 @@ defmodule Pleroma.User do
|
|||
|
||||
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()
|
||||
def invisible?(%User{invisible: true}), do: true
|
||||
def invisible?(_), do: false
|
||||
|
|
|
@ -1918,34 +1918,6 @@ defmodule Pleroma.UserTest do
|
|||
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
|
||||
test "returns true for an invisible user" do
|
||||
user = insert(:user, local: true, invisible: true)
|
||||
|
|
Loading…
Reference in a new issue