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

# Exports

> Use YB Admin permission, group, admin, and duty exports from trusted server resources.

YB Admin exposes four **server-side** exports for trusted resources. Do not call them from client code.

## `hasPermission`

Check whether an online player has a specific permission.

```lua theme={"theme":{"light":"github-light","dark":"github-dark"}}
local allowed = exports['yb-admin']:hasPermission(source, 'admin.players.ban')
```

| Parameter    | Type   | Description               |
| ------------ | ------ | ------------------------- |
| `source`     | number | Online player's server ID |
| `permission` | string | Permission key to test    |

Returns `true` or `false`. Group inheritance and wildcards are resolved automatically.

## `getGroup`

Return the player's YB Admin group name.

```lua theme={"theme":{"light":"github-light","dark":"github-dark"}}
local group = exports['yb-admin']:getGroup(source)

if group then
    print(('Staff group: %s'):format(group))
end
```

Returns a value such as `helper`, `admin`, or `owner`. Returns `nil` when the player is not staff.

## `isAdmin`

Check whether a player belongs to any YB Admin group.

```lua theme={"theme":{"light":"github-light","dark":"github-dark"}}
if exports['yb-admin']:isAdmin(source) then
    -- The player is a staff member.
end
```

This export does not require the player to be on duty.

## `isOnDuty`

Check whether a staff member currently has an active duty session.

```lua theme={"theme":{"light":"github-light","dark":"github-dark"}}
if exports['yb-admin']:isOnDuty(source) then
    -- The staff member is on duty.
end
```

Returns `false` for non-staff players.

## Recommended authorization pattern

Check duty and the exact permission before running an administrative action:

```lua theme={"theme":{"light":"github-light","dark":"github-dark"}}
RegisterNetEvent('my-resource:server:staffAction', function()
    local src = source

    if not exports['yb-admin']:isOnDuty(src) then return end
    if not exports['yb-admin']:hasPermission(src, 'admin.players.revive') then return end

    -- Validate the target and perform the server-side action.
end)
```

<Warning>
  Never trust a client-provided group, permission, player ID, amount, item name, or identifier. Validate every input on the server.
</Warning>

## Editable integration hooks

These functions are customization hooks rather than public exports:

<AccordionGroup>
  <Accordion title="Client hooks" icon="monitor-smartphone">
    `YBClientBridge.Notify`, `Revive`, `OpenAppearance`, `OpenOtherInventory`, and `PrepareVehicle` live in `editable/client.lua`.
  </Accordion>

  <Accordion title="Server hooks" icon="server">
    `YBServerBridge.GetWeather`, `SetWorld`, `SendWebhook`, and `UploadDataUrl` live in `editable/server.lua`.
  </Accordion>
</AccordionGroup>

Internal YB Admin events are implementation details. Do not trigger them from another resource.
