mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-28 17:01:14 +00:00
refactor(commands): simplify group filtering and update deprecation notice for AdminGroups
This commit is contained in:
@@ -1,13 +1,7 @@
|
||||
local CommandPermissions = Config.CommandPermissions or {}
|
||||
|
||||
local function FilterGroups(groups)
|
||||
local filtered = {}
|
||||
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" }
|
||||
return (groups and #groups > 0) and groups or { "user" }
|
||||
end
|
||||
|
||||
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}
|
||||
}
|
||||
|
||||
---@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 = {
|
||||
["owner"] = true,
|
||||
["admin"] = true,
|
||||
|
||||
Reference in New Issue
Block a user