improvements

64f8b12 · gmorell · 2026-04-26 03:08

64 files +422 -51

Files changed

modified apps/room_hermes/lib/room_hermes/accounts/rabbit_user.ex
+3 −1
@@ -6,6 +6,8 @@ defmodule RoomHermes.Accounts.RabbitUser do
6 6 field(:password, :string)
7 7 field(:username, :binary_id)
8 8 field(:topic, :string)
9 + field(:client_ids, {:array, :string}, default: [])
10 + field(:auto_register_clients, :boolean, default: true)
9 11 belongs_to(:user, RoomSanctum.Accounts.User)
10 12
11 13 timestamps()
@@ -14,7 +16,7 @@ defmodule RoomHermes.Accounts.RabbitUser do
14 16 @doc false
15 17 def changeset(rabbit_user, attrs) do
16 18 rabbit_user
17 − |> cast(attrs, [:username, :password, :topic, :user_id])
19 + |> cast(attrs, [:username, :password, :topic, :user_id, :client_ids, :auto_register_clients])
18 20 |> validate_required([:username, :password, :topic])
19 21 end
20 22 end
modified apps/room_hermes/lib/room_hermes_web/controllers/user_controller.ex
+24 −8
@@ -2,20 +2,36 @@ defmodule RoomHermesWeb.UserController do
2 2 use RoomHermesWeb, :controller
3 3
4 4 alias RoomHermes.Accounts
5 − alias RoomHermes.Accounts.RabbitUser
6 5
7 6 action_fallback RoomHermesWeb.FallbackController
8 7
9 8 def create(conn, %{"username" => username, "password" => password, "client_id" => client_id}) do
10 − case client_id == username do
11 − true ->
12 − case Accounts.find_rabbit_user(username, password) |> IO.inspect do
13 − nil -> send_resp(conn, :ok, "deny")
14 − val -> send_resp(conn, :ok, "allow")
9 + case Accounts.find_rabbit_user(username, password) do
10 + nil ->
11 + send_resp(conn, :ok, "deny")
12 +
13 + rabbit_user ->
14 + cond do
15 + client_id in rabbit_user.client_ids ->
16 + send_resp(conn, :ok, "allow")
17 +
18 + rabbit_user.auto_register_clients ->
19 + Accounts.update_rabbit_user(rabbit_user, %{
20 + client_ids: Enum.uniq([client_id | rabbit_user.client_ids])
21 + })
22 +
23 + send_resp(conn, :ok, "allow")
24 +
25 + true ->
26 + send_resp(conn, :ok, "deny")
15 27 end
28 + end
29 + end
16 30
17 − false ->
18 − send_resp(conn, :ok, "deny")
31 + def create(conn, %{"username" => username, "password" => password}) do
32 + case Accounts.find_rabbit_user(username, password) do
33 + nil -> send_resp(conn, :ok, "deny")
34 + _ -> send_resp(conn, :ok, "allow")
19 35 end
20 36 end
21 37 end
added apps/room_hermes/priv/repo/migrations/20260425000000_add_client_ids_to_users_rabbit.exs
+10 −0
@@ -0,0 +1,10 @@
1 +defmodule RoomHermes.Repo.Migrations.AddClientIdsToUsersRabbit do
2 + use Ecto.Migration
3 +
4 + def change do
5 + alter table(:users_rabbit) do
6 + add :client_ids, {:array, :string}, default: [], null: false
7 + add :auto_register_clients, :boolean, default: true, null: false
8 + end
9 + end
10 +end
modified ?
+0 −0

Binary file — not rendered.

modified ?
+0 −0

Binary file — not rendered.

modified ?
+0 −0

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum/accounts/rabbit_user.ex
+3 −1

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum/configuration.ex
+27 −0

Click to load diff…

added apps/room_sanctum/lib/room_sanctum/configuration/scribus_resolution.ex
+27 −0

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum/workers/ankyra_worker.ex
+57 −25

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum_web/components/layouts/_action_menu.html.heex
+1 −1

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_ankyra/show.ex
+40 −3

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_ankyra/show.html.heex
+66 −1

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_pythiae_live/show.ex
+12 −0

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_pythiae_live/show.html.heex
+31 −7

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_scribus_live/form_component.ex
+7 −2

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_scribus_live/index.ex
+35 −2

Click to load diff…

modified apps/room_sanctum/lib/room_sanctum_web/live/cfg_scribus_live/index.html.heex
+44 −0

Click to load diff…

added apps/room_sanctum/priv/repo/migrations/20260425221500_create_cfg_scribus_resolutions.exs
+35 −0

Click to load diff…

modified ?
+0 −0

Click to load diff…

modified ?
+0 −0

Click to load diff…

modified ?
+0 −0

Click to load diff…

modified ?
+0 −0

Click to load diff…

modified ?
+0 −0

Click to load diff…

modified ?
+0 −0

Click to load diff…

modified ?
+0 −0

Click to load diff…

modified ?
+0 −0

Click to load diff…

modified ?
+0 −0

Click to load diff…

modified ?
+0 −0

Click to load diff…

modified ?
+0 −0

Click to load diff…

modified ?
+0 −0

Click to load diff…

modified ?
+0 −0

Click to load diff…

modified ?
+0 −0

Click to load diff…

modified ?
+0 −0

Click to load diff…

modified ?
+0 −0

Click to load diff…

Parents: d35b4f7