Permissions

  • By default there's some permissions that can't be removed, those are used for Business APP and if you remove them it won't show any tab, this default permissions are:

Config.Permissions = {
    -- value: string, label: string, jobs: false or table with jobs who can access this permission
    { value = "employees",    label = "Employees", jobs = false }, -- Used for App (don't edit value field)
    { value = "menu",         label = "Menu", jobs = false  }, -- Used for App (don't edit value field)
    { value = "bank",         label = "Bank", jobs = false  }, -- Used for App (don't edit value field)
    { value = "applications", label = "Applications", jobs = false  }, -- Used for App (don't edit value field)
    { value = "stashes",      label = "Stashes", jobs = false  }, -- Gives access to business stashes
}

Employees: Players with this permission will be able to access the Employees tab and all its features (hire/fire players, send bonus, edit employees, etc)

Menu: Gives access to the Menu tab where players can register new items, edit or remove them. If the business is blacklisted the permission will be ignored.

Bank: This permission gives access to see the available funds in the overview tab and add/remove funds from the bank tab.

Applications: Gives access to the applications tab where you can see the job applications.

Stahes: Required to access the default stashes zones for the business.

Custom Permissions

  • For this example we are gonna create a new permission named Evidence Stash which is gonna be available only for police and bcso jobs:

Config.Permissions = {
    -- value: string, label: string, jobs: false or table with jobs who can access this permission
    { value = "employees",    label = "Employees", jobs = false }, -- Used for App (don't edit value field)
    { value = "menu",         label = "Menu", jobs = false  }, -- Used for App (don't edit value field)
    { value = "bank",         label = "Bank", jobs = false  }, -- Used for App (don't edit value field)
    { value = "applications", label = "Applications", jobs = false  }, -- Used for App (don't edit value field)
    { value = "stashes",      label = "Stashes", jobs = false  }, -- Gives access to business stashes
    { value = "evidence_stash", label = "Evidence Stash", jobs = {"police", "bcso"}  }, -- Gives access to evidence stashes / this is just an example of a custom permission
}
  • Once the permission is added the business owner will be able to assign it to his employees using the Employees Tab in Business APP

Get Player Permissions

  • You can use the following export client/server side to retrieve the player permissions:

Client Side:

-- Client side doesn't need to send source or any argument
local permissions = exports['av_business']:getPermissions()

Server Side:

-- source:number required
-- job:string optional
local permissions = exports['av_business']:getPermissions(source,job)

Both exports will return a table with the player permissions, this is an example on how it can looks like:

local permissions = exports['av_business']:getPermissions()
print(json.encode(permissions))
-- the table can look something like this, 
-- depending on your actual character permissions it can have more or less:
--[[
    {
        "applications": true,
        "bank": true,
        "evidence": true,
        "isBoss": true,
        "evidence_stash": true,
    }
]]--

You can find a better example in Zones

Last updated