Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Tester role to use $balancemode in unbossed lobby #357

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/teiserver/coordinator/consul_server.ex
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ defmodule Teiserver.Coordinator.ConsulServer do

@always_allow ~w(status s y n follow joinq leaveq splitlobby afks roll players password? newlobby jazlobby tournament)
@boss_commands ~w(balancemode gatekeeper welcome-message meme reset-approval rename minchevlevel maxchevlevel resetchevlevels resetratinglevels minratinglevel maxratinglevel setratinglevels)
# A tester can use these commands when there is no boss
@tester_commands ~w(balancemode)
@vip_boss_commands ~w(shuffle)
@host_commands ~w(specunready makeready settag speclock forceplay lobbyban lobbybanmult unban forcespec forceplay lock unlock makebalance)

Expand Down Expand Up @@ -1013,6 +1015,7 @@ defmodule Teiserver.Coordinator.ConsulServer do
is_host = senderid == state.host_id
is_boss = Enum.member?(state.host_bosses, senderid)
is_vip = Enum.member?(user.roles, "VIP")
is_tester = Enum.member?(user.roles, "Tester")

cond do
client == nil ->
Expand All @@ -1033,6 +1036,9 @@ defmodule Teiserver.Coordinator.ConsulServer do
Enum.member?(@boss_commands, cmd.command) and (is_host or is_boss) ->
true

Enum.member?(@tester_commands, cmd.command) and length(state.host_bosses) == 0 and is_tester ->
true

Enum.member?(@vip_boss_commands, cmd.command) and (is_vip and is_boss) ->
true

Expand Down
Loading