Fakultas Ilmu Komputer UI

Commit 90cfd5fb authored by Muhammad Rafif Elfazri's avatar Muhammad Rafif Elfazri
Browse files

add checkadmin function

parent 5aa4c5ad
...@@ -45,4 +45,13 @@ defmodule DiskuyWeb.Auth.Guardian do ...@@ -45,4 +45,13 @@ defmodule DiskuyWeb.Auth.Guardian do
end end
end end
def check_admin(user) do
case user.role == "admin" do
true ->
{:ok, :authorized}
false ->
{:error, :unauthorized}
end
end
end end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment