Elite NetworkElite SaaS · Docsv0.1
GitHubPainel

Punishments API

Aplicar e reverter jail, temp_ban, kick, perm_ban e remoção de whitelist.

Implementado em functions/punishments.lua. Histórico fica em Config.PunishmentsHistoryTableName (auto criada).
GET/elite-saas/punishments/search?q=<query>🔒 auth

Mesma busca de player_search. Use pra achar quem você quer punir.


GET/elite-saas/punishments/<userId>🔒 auth

Status atual + histórico completo de punições aplicadas a esse usuário.

json
{
  "userId": 4823,
  "active": {
    "jail": false,
    "temp_ban": false,
    "perm_ban": false,
    "wl_remove": false
  },
  "history": [
    {
      "id": 12,
      "type": "jail",
      "reason": "RDM em zona segura",
      "durationMinutes": 30,
      "expiresAt": "2026-05-24T22:30:00Z",
      "appliedAt": "2026-05-24T22:00:00Z",
      "appliedBy": "@lucas",
      "revertedAt": null,
      "revertedBy": null,
      "status": "expired"
    }
  ]
}

Aplicar punição

POST/elite-saas/punishments/<userId>/apply🔒 auth

Aplica uma punição. O `type` determina o handler vRP.

Body

type
stringrequired
Um de jail, temp_ban, kick, perm_ban ou wl_remove.
reason
stringoptional
Motivo livre. Persistido na tabela de histórico.
minutes
integeroptional
Obrigatório para jail e temp_ban. Ignorado para kick, perm_ban e wl_remove.

Comportamento por tipo

jail
optional
Chama vRP.jail() ou TriggerEvent("vrp_prison:put") conforme o que existir no servidor. Auto-libera depois de minutes.
temp_ban
optional
INSERT/UPDATE em vrp_user_bans com until = now + minutes. Se online, DropPlayer imediato.
kick
optional
Só desconecta — não persiste ban.
perm_ban
optional
INSERT em vrp_user_bans com until = NULL (sem expiração).
wl_remove
optional
Remove da whitelist. Faz vRP.removeUserGroup(userId, "user") ou seta vrp_user_data conforme implementação.
bash
curl -X POST http://IP:30120/elite-saas/punishments/4823/apply \
  -H "Authorization: Bearer SEU_TOKEN" \
  -H "x-tenant-id: elite-city" \
  -H "Content-Type: application/json" \
  -d '{"type":"jail","minutes":30,"reason":"RDM zona segura"}'
json
{ "ok": true, "type": "jail", "id": 13 }

Reverter punição

POST/elite-saas/punishments/<userId>/revert🔒 auth

Reverte uma punição ativa. `type` deve coincidir com a que está em vigor.

Body

type
stringrequired
jail, temp_ban, perm_ban ou wl_remove (kick não tem reversão — já foi).
reason
stringoptional
Motivo da reversão (registrado no histórico).
json
{ "ok": true, "type": "perm_ban", "revertedHistoryId": 8 }

Tabelas envolvidas

  • vrp_user_bans — bans (until, reason).
  • vrp_user_data — flag de whitelist (dkey="vRP:whitelisted").
  • Config.PunishmentsHistoryTableName — histórico imutável de aplicações e reversões. Auto-criada no boot.

Permissões no painel

Os endpoints exigem users.ban (apply) e users.unban (revert). Garanta na role do staff.

Eventos no Live Feed
Quando você empurra EliteSaaSEvents.punishment(...) dentro do handler, a ação vira evento no Live Feed da equipe inteira. Veja Events API.
Elite Network — Command Center