Skip to content

Commit

Permalink
mix format + address @sourcelevel-bot issue (line-spacing) 🙄
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Sep 17, 2020
1 parent be9b1f9 commit 23df807
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions lib/auth/app.ex
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ defmodule Auth.App do
end

# Returning all apps when person_id == 1 (superadmin) means
# the superadmin can always see/manage all apps as necessary.
#  the superadmin can always see/manage all apps as necessary.
# Later we could refactor this function to use RBAC.has_role_any/2.
def list_apps(conn) when is_map(conn) do
case conn.assigns.person.id == 1 do
Expand All @@ -57,7 +57,6 @@ defmodule Auth.App do
|> Repo.all()
end


@doc """
Gets a single app.
Expand Down
8 changes: 5 additions & 3 deletions lib/auth_web/controllers/role_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,13 @@ defmodule AuthWeb.RoleController do
end

# https://elixirforum.com/t/map-key-is-a-atom-or-string/13285/2
# our use-case for this is specific keys in controller params
#  our use-case for this is specific keys in controller params
# mix gen creates tests with atom keys whereas controller expect string keys!
defp map_get(map, string_key, default \\ 0) do
to_string(Map.get(map, string_key) ||
Map.get(map, String.to_atom(string_key), default))
to_string(
Map.get(map, string_key) ||
Map.get(map, String.to_atom(string_key), default)
)
end

defp person_owns_app?(apps, app_id) do
Expand Down

0 comments on commit 23df807

Please sign in to comment.