Skip to content

Instantly share code, notes, and snippets.

@imetallica
Created January 28, 2016 16:48
Show Gist options
  • Save imetallica/a5db353e9336ab31d310 to your computer and use it in GitHub Desktop.
Save imetallica/a5db353e9336ab31d310 to your computer and use it in GitHub Desktop.
defp set_tokens(conn, user_from_db) do
case user_from_db.account_level do
99 -> # Admin level
Guardian.Plug.sign_in(conn, user_from_db, perms: %{admin: [:all]})
redirect(conn, to: page_path(conn, :index))
_ -> # Not yet implemented
redirect(conn, to: page_path(conn, :index))
end
end
# Error
## unable to encode value: {:perms, %{admin: [:all]}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment