# Player Interaction Whitelist

> Reference for Player Interaction Whitelist in sky_jobs_base.

[All server exports](/docs/base/jobs-base/server-exports)

## Player Interaction Whitelist

Shared player interactions are job-whitelisted. Register the jobs owned by your resource before using any player-interaction client or server export. Registration authorizes existing jobs only; it does not create framework jobs or Sky Jobs groups.

`sky_policejob` automatically registers its configured Police jobs with the `police` policy from `Config.JobPlayerInteractions`. `sky_crimesystem` does the same for its Crime jobs and the `crime` policy. Both refresh their registration after Job Configurator updates.

### `registerInteractionJobs(groupKey, jobs, permissions?)`

- `groupKey` (`string`) - unique key owned by the calling resource.
- `jobs` (`string[] | table[]`) - job names or job definitions containing a `name`.
- `permissions` (`table?`) - required for custom groups. It may be omitted when `groupKey` already has a policy in `Config.JobPlayerInteractions.groups`.
- Returns `boolean, string?`.

Supported permission fields:

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Purpose
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        requireOnDuty
      </code>
    </td>
    
    <td>
      Requires the current player to be on duty for every enabled action.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        cuffs
      </code>
    </td>
    
    <td>
      Apply and remove handcuffs.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        zipties
      </code>
    </td>
    
    <td>
      Apply, remove, and cut zipties.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        legRestraints
      </code>
    </td>
    
    <td>
      Apply and remove leg restraints.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        escort
      </code>
    </td>
    
    <td>
      Start and stop escorting a restrained player.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        vehicle
      </code>
    </td>
    
    <td>
      Place escorted players in vehicles or remove restrained players from vehicles.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        headBag
      </code>
    </td>
    
    <td>
      Apply and remove head bags.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        search
      </code>
    </td>
    
    <td>
      Open and transfer items through player search.
    </td>
  </tr>
</tbody>
</table>

```lua
local registered, reason = exports["sky_jobs_base"]:registerInteractionJobs(
    "security",
    {
        "security",
        { name = "security_night" }
    },
    {
        requireOnDuty = true,
        cuffs = true,
        zipties = false,
        legRestraints = true,
        escort = true,
        vehicle = true,
        headBag = false,
        search = true
    }
)

if not registered then
    print(("Unable to register security interactions: %s"):format(reason))
end
```

<callout color="warning" icon="i-lucide-triangle-alert">

Call this export from a server script during resource startup, after the final job list is known. Call it again when your resource changes that list at runtime. Group keys are resource-owned, registrations are removed when the owner resource stops, and another resource cannot overwrite the same key.

</callout>

Registering jobs only grants the selected interaction capabilities to players whose current job matches the registration. It does not execute an action, bypass item requirements, or trust client input.

### `unregisterInteractionJobs(groupKey)`

Removes a group registered by the calling resource.

```lua
exports["sky_jobs_base"]:unregisterInteractionJobs("security")
```

The export returns `false, "not_owner"` if another resource owns the group.

### `hasInteractionAccess(sourceId, permission)`

Checks the same server-authoritative job and duty policy used by the interaction actions.

```lua
local allowed, reason = exports["sky_jobs_base"]:hasInteractionAccess(source, "search")
```

Possible failure reasons include `not_authorized`, `not_on_duty`, and `invalid_permission`.
