Skip to content

Commit

Permalink
fix redundant protection check when "protection_bypass" priv is avail…
Browse files Browse the repository at this point in the history
…able
  • Loading branch information
BuckarooBanzay committed Mar 4, 2021
1 parent 6988e8c commit 1a0f781
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions commands/upload_chat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ minetest.register_chatcommand("bx_save", {
description = "Uploads the selected region to the blockexchange server",
func = function(name, schemaname)
local has_protected_upload_priv = minetest.check_player_privs(name, { blockexchange_protected_upload = true })
local has_blockexchange_priv = minetest.check_player_privs(name, { blockexchange = true })
local has_blockexchange_priv = minetest.check_player_privs(name, { blockexchange = true })
local has_protection_bypass_priv = minetest.check_player_privs(name, { protection_bypass = true })

if not has_blockexchange_priv and not has_protected_upload_priv then
return false, "Required privs: 'blockexchange' or 'blockexchange_protected_upload'"
Expand All @@ -27,7 +28,7 @@ minetest.register_chatcommand("bx_save", {
return false, "you need to set /bx_pos1 and /bx_pos2 first!"
end

if not has_blockexchange_priv and has_protected_upload_priv then
if not has_blockexchange_priv and has_protected_upload_priv and not has_protection_bypass_priv then
-- kick off protection-check worker and add deferred upload context
blockexchange.protectioncheck(name, pos1, pos2, schemaname)
else
Expand Down

0 comments on commit 1a0f781

Please sign in to comment.