Skip to content

Commit 4f3e855

Browse files
fix: No auth was not working (#551)
1 parent 5f2ea52 commit 4f3e855

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

apps/lenra_web/lib/lenra_web/app_adapter.ex

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,20 @@ defmodule LenraWeb.AppAdapter do
1515
@impl ApplicationRunner.Adapter
1616
def allow(user_id, app_name) do
1717
with %App{} = application <- get_app(app_name),
18-
user <- Accounts.get_user(user_id) do
18+
user <- get_user(user_id) do
1919
Bouncer.allow(LenraWeb.AppAdapter.Policy, :join_app, user, application)
2020
else
2121
_err ->
2222
BusinessError.forbidden_tuple()
2323
end
2424
end
2525

26+
defp get_user(user_id) when is_nil(user_id), do: nil
27+
28+
defp get_user(user_id) do
29+
Accounts.get_user(user_id)
30+
end
31+
2632
@impl ApplicationRunner.Adapter
2733
def get_function_name(app_name) do
2834
lenra_env = Application.fetch_env!(:lenra, :lenra_env)

0 commit comments

Comments
 (0)