refactor(commands): simplify group filtering and update deprecation notice for AdminGroups

This commit is contained in:
Ihsan
2026-08-08 00:16:03 +05:30
parent e85b05558c
commit 4a22b68511
2 changed files with 4 additions and 7 deletions
@@ -1,13 +1,7 @@
local CommandPermissions = Config.CommandPermissions or {} local CommandPermissions = Config.CommandPermissions or {}
local function FilterGroups(groups) local function FilterGroups(groups)
local filtered = {} return (groups and #groups > 0) and groups or { "user" }
for _, group in ipairs(groups or {}) do
if Config.AdminGroups[group] ~= false then
filtered[#filtered + 1] = group
end
end
return #filtered > 0 and filtered or { "admin" }
end end
ESX.RegisterCommand( ESX.RegisterCommand(
@@ -34,6 +34,9 @@ Config.DefaultSpawns = { -- If you want to have more spawn positions and select
--{x = 233.5459, y = -868.2626, z = 30.2922, heading = 1.0} --{x = 233.5459, y = -868.2626, z = 30.2922, heading = 1.0}
} }
---@deprecated Use `Config.CommandPermissions` as the single source of truth for command ACLs.
--- Kept temporarily for backwards compatibility with external resources that still read `Config.AdminGroups`.
--- Will be removed in ESX 1.15.
Config.AdminGroups = { Config.AdminGroups = {
["owner"] = true, ["owner"] = true,
["admin"] = true, ["admin"] = true,