Skip to content
Open
Show file tree
Hide file tree
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
18 changes: 10 additions & 8 deletions server/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ function UnpackJob(data)
return job, grade
end

-- Ensure the user has permission to access the MDT
-- Checks if the user is in the allowed jobs list and if they have the required grade (if applicable)
function PermCheck(src, PlayerData)
local result = true

if not Config.AllowedJobs[PlayerData.job.name] then
print(("UserId: %s(%d) tried to access the mdt even though they are not authorised (server direct)"):format(GetPlayerName(src), src))
result = false
end

return result
local allowedJob = Config.AllowedJobs[PlayerData.job.name]

if not allowedJob or (allowedJob.minGradeRequired and PlayerData.job.grade.level < allowedJob.minGradeRequired) then
print(("UserId: %s(%d) tried to access the MDT without authorization (server direct)"):format(GetPlayerName(src), src))
return false
end
return true
Comment on lines +24 to +31
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent indentation detected. The codebase uses tabs for indentation (visible in lines 27-28 and throughout the rest of the file), but lines 24, 26, 29, and 31 use spaces. Please use tabs to maintain consistency with the rest of the codebase.

Suggested change
local allowedJob = Config.AllowedJobs[PlayerData.job.name]
if not allowedJob or (allowedJob.minGradeRequired and PlayerData.job.grade.level < allowedJob.minGradeRequired) then
print(("UserId: %s(%d) tried to access the MDT without authorization (server direct)"):format(GetPlayerName(src), src))
return false
end
return true
local allowedJob = Config.AllowedJobs[PlayerData.job.name]
if not allowedJob or (allowedJob.minGradeRequired and PlayerData.job.grade.level < allowedJob.minGradeRequired) then
print(("UserId: %s(%d) tried to access the MDT without authorization (server direct)"):format(GetPlayerName(src), src))
return false
end
return true

Copilot uses AI. Check for mistakes.
end

function ProfPic(gender, profilepic)
Expand Down
29 changes: 16 additions & 13 deletions shared/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,29 @@ Config.RosterLink = {
['sapr'] = '',
}

-- Set the min grade level required to access the MDT
-- Set to 0 to allow all grades
Config.PoliceJobs = {
['police'] = true,
['lspd'] = true,
['bcso'] = true,
['sast'] = true,
['sasp'] = true,
['doc'] = true,
['lssd'] = true,
['sapr'] = true,
['pa'] = true
['police'] = { minGradeRequired = 0 },
['lspd'] = { minGradeRequired = 0 },
['bcso'] = { minGradeRequired = 0 },
['sast'] = { minGradeRequired = 0 },
['sasp'] = { minGradeRequired = 0 },
['doc'] = { minGradeRequired = 0 },
['lssd'] = { minGradeRequired = 0 },
['sapr'] = { minGradeRequired = 0 },
['pa'] = { minGradeRequired = 0 }
}

Config.AmbulanceJobs = {
['ambulance'] = true,
['doctor'] = true
['ambulance'] = { minGradeRequired = 0 },
['doctor'] = { minGradeRequired = 0 }
}

-- Add ranks
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment "Add ranks" is unclear and inconsistent with the comments for PoliceJobs and AmbulanceJobs above. Consider changing this to match the format used for the other job tables (e.g., "Set the min grade level required to access the MDT" or remove it entirely to avoid confusion).

Suggested change
-- Add ranks
-- Set the min grade level required to access the MDT
-- Set to 0 to allow all grades

Copilot uses AI. Check for mistakes.
Config.DojJobs = {
['lawyer'] = true,
['judge'] = true
['lawyer'] = { minGradeRequired = 0 },
['judge'] = { minGradeRequired = 0 }
}

-- This is a workaround solution because the qb-menu present in qb-policejob fills in an impound location and sends it to the event.
Expand Down