diff --git a/lib/teiserver/mix_tasks/fake_data.ex b/lib/teiserver/mix_tasks/fake_data.ex index 1b322b40b..2ca10e0f6 100644 --- a/lib/teiserver/mix_tasks/fake_data.ex +++ b/lib/teiserver/mix_tasks/fake_data.ex @@ -96,7 +96,7 @@ defmodule Mix.Tasks.Teiserver.Fakedata do name: generate_throwaway_name() |> String.replace(" ", ""), email: UUID.uuid1(), password: root_user.password, - permissions: ["admin.dev.developer"], + permissions: [], icon: "fa-solid #{StylingHelper.random_icon()}", colour: StylingHelper.random_colour(), trust_score: 10_000, diff --git a/lib/teiserver/mix_tasks/fake_playtime.ex b/lib/teiserver/mix_tasks/fake_playtime.ex index 4bc371f08..72fa3cb72 100644 --- a/lib/teiserver/mix_tasks/fake_playtime.ex +++ b/lib/teiserver/mix_tasks/fake_playtime.ex @@ -36,16 +36,8 @@ defmodule Mix.Tasks.Teiserver.FakePlaytime do # Now recalculate ranks # This calc would usually be done in do_login rank = CacheUser.calculate_rank(user_id) - user = Teiserver.Account.UserCacheLib.get_user_by_id(user_id) - user = %{ - user - | rank: rank - } - - CacheUser.update_user(user, true) - - Account.update_user_stat(user.id, %{ + Account.update_user_stat(user_id, %{ rank: rank }) end diff --git a/lib/teiserver_web/live/battles/match/show.ex b/lib/teiserver_web/live/battles/match/show.ex index f93bc9197..d520d5011 100644 --- a/lib/teiserver_web/live/battles/match/show.ex +++ b/lib/teiserver_web/live/battles/match/show.ex @@ -54,8 +54,10 @@ defmodule TeiserverWeb.Battle.MatchLive.Show do end defp apply_action(%{assigns: %{match_name: match_name}} = socket, :balance, _params) do + # Restrict the balance tab to certain roles. + # Note that Staff roles like "Tester" also contain Contributor role. socket - |> mount_require_any(["Reviewer"]) + |> mount_require_any(["Overwatch", "Contributor"]) |> assign(:page_title, "#{match_name} - Balance") end diff --git a/lib/teiserver_web/live/battles/match/show.html.heex b/lib/teiserver_web/live/battles/match/show.html.heex index 5dfc103d7..94f221395 100644 --- a/lib/teiserver_web/live/battles/match/show.html.heex +++ b/lib/teiserver_web/live/battles/match/show.html.heex @@ -41,7 +41,7 @@ <% end %> - <%= if @rating_logs != %{} and allow?(@current_user, "Overwatch") do %> + <%= if @rating_logs != %{} and allow_any?(@current_user, ["Overwatch", "Contributor"]) do %> <.tab_nav url={~p"/battle/#{@match.id}/balance"} selected={@tab == :balance}> Balance @@ -282,18 +282,18 @@ <% end %> - <%= if allow?(@current_user, "Overwatch") do %> + <%= if allow_any?(@current_user, ["Overwatch", "Contributor"]) do %>
-
- <.input + + <.input type="select" label="Balancer" options={@balancer_options} name="balancer" value={@balancer} phx-change="update-balancer" - /> -
+ /> +

Based on data at the time