Remove function superuser?
Everything now happens with privileged?/2
This commit is contained in:
parent
eab13fed3e
commit
a1c8aa4721
|
@ -371,11 +371,6 @@ defp privileged_for?(privilege_tag, true, config_role_key),
|
|||
|
||||
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 @@ test "returns true for local admins if, and only if, they are privileged" 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 New Issue