# Permissions & Groups

**moh-stoptroll** has **two separate permission systems** — one for Stopfire and one for Community Service. This lets you assign different staff levels to each punishment type.

***

### Stopfire Permissions

These control who can open the panel and apply/manage **Stopfire** sentences.

```lua
Config.AllowQBCoreGroups = true
Config.AllowedGroups     = { 'god', 'admin', 'mod' }

Config.AllowedLicenses = {
    "license:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
}
```

| Variable                   | Type      | Description                            |
| -------------------------- | --------- | -------------------------------------- |
| `Config.AllowQBCoreGroups` | `boolean` | Enable group-based permission check    |
| `Config.AllowedGroups`     | `table`   | List of QBCore groups with access      |
| `Config.AllowedLicenses`   | `table`   | Specific Rockstar licenses with access |

***

### Community Service Permissions

These control who can apply/manage **Community Service** sentences.

```lua
Config.ComservAllowQBCoreGroups = true
Config.ComservAllowedGroups     = { 'god', 'admin' }

Config.ComservAllowedLicenses = {
    "license:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
}
```

| Variable                          | Type      | Description                          |
| --------------------------------- | --------- | ------------------------------------ |
| `Config.ComservAllowQBCoreGroups` | `boolean` | Enable group-based permission check  |
| `Config.ComservAllowedGroups`     | `table`   | List of QBCore groups with CS access |
| `Config.ComservAllowedLicenses`   | `table`   | Specific licenses with CS access     |

***

### How Permissions Work

The permission check runs in this order:

1. **License check** — Is the player's `license:` identifier in the allowed list?
2. **Group check** (if `AllowQBCoreGroups = true`) — Is the player's QBCore group in `AllowedGroups`?

If **either** check passes, the player has access.

```
Player opens /stoptroll
        │
        ▼
  License in AllowedLicenses?  ──YES──► ALLOW
        │
        NO
        │
        ▼
  AllowQBCoreGroups = true?
        │
        ▼
  Group in AllowedGroups?  ──YES──► ALLOW
        │
        NO
        │
        ▼
       DENY
```

***

### How to Find a Player's License

In the server console, run:

```
playerids <server_id>
```

Or check your database — QBCore stores the license as `citizenid` prefix. The license format is:

```
license:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

Add the full string (including `license:`) to `Config.AllowedLicenses`.

***

### Example — Different Staff Tiers

```lua
-- Only senior admins can do Community Service
Config.ComservAllowedGroups = { 'god', 'admin' }

-- Mods can only do Stopfire
Config.AllowedGroups = { 'god', 'admin', 'mod' }
```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mohssins.gitbook.io/mohscriptsdocs/moh-stoptroll/permissions-and-groups.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
