> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aps-store.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Government Portal

An app for government staff: review business registrations, manage businesses, look up citizens and manage their licenses, documents and bills. Every action is logged.

## Access

`config/government.lua` — switch the module off with `Config.Features.government = false`.

```lua theme={null}
Config.Government = {
    access = 'both',   -- 'job' | 'login' | 'both'
    jobs = {
        -- job name → { [minimum grade] = role }; the highest grade reached wins
        ['government'] = { [0] = 'clerk', [2] = 'manager', [4] = 'mayor' },
    },
    loginAttempts  = 5,     -- wrong passwords before a lockout
    lockoutSeconds = 120,
}
```

| Mode | Who gets in |
| - | - |
| `'job'` | Players with a job and grade listed in `jobs`. The app is hidden from everybody else. |
| `'login'` | Anyone who signs in with an account from `Config.GovernmentAccounts`. |
| `'both'` | Job players get in directly, everybody else sees the sign-in screen. |

Accounts live in `config/config.server.lua`, which players never receive:

```lua theme={null}
Config.GovernmentAccounts = {
    { username = 'mayor',  password = 'S3cure-Pass', role = 'mayor', label = 'Office of the Mayor' },
    { username = 'clerk1', password = 'An0ther-Pass', role = 'clerk', label = 'Front Desk' },
}
```

> [!WARNING]
>
> Accounts that still use the example password `change-me` are disabled, and the console warns about them on start. Signing out of the PC also signs out of the portal.

## Roles & permissions

```lua theme={null}
roles = {
    clerk     = { label = 'Clerk',     permissions = { 'businesses.review', 'permits.review', 'citizens.view' } },
    inspector = { label = 'Inspector', permissions = { 'businesses.inspect', 'citizens.view' } },
    auditor   = { label = 'Auditor',   permissions = { 'citizens.view', 'log.view' } },
    manager   = { label = 'Manager',   permissions = { 'businesses.review', 'businesses.manage', 'permits.review',
                    'businesses.inspect', 'citizens.view', 'licenses.manage', 'documents.manage', 'bills.manage', 'log.view' } },
    mayor   = { label = 'Mayor',   permissions = { '*' } },
}
```

| Permission | Allows |
| - | - |
| `businesses.review` | Approve or reject business registrations |
| `businesses.manage` | Suspend, reactivate and close any business; link it to a job; revoke permits; remove business vehicles and employees |
| `permits.review` | Grant or reject permit applications |
| `businesses.inspect` | Record inspections and fine businesses |
| `citizens.view` | Search citizens and see their licenses, documents, bills, vehicles and businesses |
| `licenses.manage` | Grant and revoke licenses (also synced via `Config.LicenseSync`) |
| `documents.manage` | Revoke valid documents |
| `bills.manage` | Cancel unpaid bills |
| `log.view` | Read the activity log |
| `*` | Everything |

The server checks the permission on every request. Job access is re-checked each time, so a fired employee loses access immediately.

## Business registrations

```lua theme={null}
businesses = {
    approval       = true,   -- new businesses wait for review before they are listed
    refundOnReject = 1.0,    -- share of the fee paid back on rejection (0.0 – 1.0)
    requireReason  = true,   -- a reason is required to reject, suspend, close or cancel a bill
},
logDays = 30,                -- days of activity log shown in the portal
```

* With `approval` on, a registration is *pending* until staff approve it. The owner sees the status in *My Businesses* and gets a phone notification for the decision.
* A rejected request shows the reason. The owner can edit it and resubmit, or remove it. Withdrawing a pending request refunds like a rejection.
* Refunds also reach offline players (paid into their account in the database).
* Suspended businesses are hidden from the directory until reactivated.
* *Open record…* on a business shows its permits, vehicles, employees, inspections and job link.

## Inspections

```lua theme={null}
inspections = {
    results = { 'Passed', 'Passed with remarks', 'Failed' },
    maxFine = 50000,   -- 0 = no fines
    dueDays = 7,
    society = nil,     -- e.g. 'society_government' to receive the fines
},
```

An inspection saves the result and notes on the business record. A fine is sent to the owner as a ticket in Bills & Fines, also when they are offline.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.