diff --git a/server/functions.lua b/server/functions.lua index 36c0a1c..ab6de98 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -321,7 +321,7 @@ function QBCore.Functions.HasPermission(source, permission) local Player = QBCore.Functions.GetPlayer(source) if next(QBCore.Config.Server.AllPermissions) then for i = 1, #QBCore.Config.Server.AllPermissions do - if QBCore.Config.Server.AllPermissions[i] == permission then + if QBCore.Config.Server.AllPermissions[i] == Player.PlayerData.permission then return true end end diff --git a/server/player.lua b/server/player.lua index a45a577..c596f2a 100644 --- a/server/player.lua +++ b/server/player.lua @@ -45,10 +45,10 @@ function QBCore.Player.CheckPlayerData(source, PlayerData) PlayerData.cid = PlayerData.cid or 1 if not QBCore.Config.Server.UseOldPermissionSystem then if PlayerData.permission then ExecuteCommand(('remove_principal identifier.%s group.%s'):format(PlayerData.license, PlayerData.permission)) end - PlayerData.permission = PlayerData.permission or 'user' - if IsPlayerAceAllowed(source, 'command') and IsPlayerAceAllowed(source, 'webadmin') then -- if both are true then the person has group.admin and is a system admin + if not PlayerData.permission and IsPlayerAceAllowed(source, 'command') and IsPlayerAceAllowed(source, 'webadmin') then -- if both aces are allowed then the person has group.admin and is a system admin PlayerData.permission = QBCore.Config.Server.AllPermissions[1] or 'god' end + PlayerData.permission = PlayerData.permission or 'user' ExecuteCommand(('add_principal identifier.%s group.%s'):format(PlayerData.license, PlayerData.permission)) PlayerData.optin = PlayerData.optin or true end