# Permissions

Quests uses the shared `ks.<mod>.<scope>.<action>` scheme. Player commands check `ks.quest.user.*`, and everything admin checks `ks.quest.admin`.

---

## Permission nodes

| Permission | What it allows | Default |
|------------|----------------|---------|
| `ks.quest.user.use` | Open the Questbook (`/ksquest`, Core dialogs that open it) | granted |
| `ks.quest.user.settings` | Open the Questbook settings (`/ksquest settings`, `/ksquestsettings`) | granted |
| `ks.quest.admin` | Every `/ksquestadmin` subcommand, the admin window from every way in, the NPC profile editor and the players tool | staff only |
| `ks.core.admin.dialog.console` | **In addition to** `ks.quest.admin`: add, change or remove anything that runs as the server console (see below) | staff only |

The two player nodes count as granted while they are not set. Deny them to lock a feature for a group.

Two links in the admin window lead into KyuubiSoft Core and use Core's rules: **Token shop** opens Core's shop editor (needs `ks.admin`), and **NPC management** / **Open in Core's dialog editor** need `ks.citizen.admin` or `ks.admin`.

---

## The console rule

Some quest content runs a server command **as the console**, with every right on the server:

- Command rewards with `"executor": "console"` (the default executor) in quests and chapters.
- Console command actions in NPC profile dialogs.

To add, change or remove such entries, an admin needs both `ks.quest.admin` **and** `ks.core.admin.dialog.console`. This is the same node Core's dialog, NPC and shop editors use. Without it:

- The admin window shows these entries locked. Everything else of the quest stays editable, and a reward row ignores attempts to turn it into a console command through its currency or value field.
- Saving is checked again on the server.
- `/ksquestadmin import` refuses to add console command rewards.
- Web editor imports (with Core 2.9.2) keep the console commands that are on the server: added ones are dropped, removed ones come back, changed ones are reverted, and a removed quest or chapter that had one stays. The rest of the import is applied, and the web editor result lists the kept entries. An NPC profile whose console actions changed is not imported.

Commands that run as the player are not affected. The real server console has every right.

---

## Player commands

| Command | Aliases | Permission |
|---------|---------|------------|
| `/ksquest` | `ksquests`, `ksquestbook`, `kqb`, `questbook`, `qb` | `ks.quest.user.use` |
| `/ksquest settings` | `/ksquest config` | `ks.quest.user.settings` |
| `/ksquestsettings` | — | `ks.quest.user.settings` |

---

## Admin commands

`/ksquestadmin` (alias `qadmin`). Every subcommand needs `ks.quest.admin`.

| Command | Console | What it does |
|---------|:-------:|--------------|
| `reload` | ✅ | Reloads config and content from disk |
| `panel` | ❌ | Opens the admin window |
| `npcprofile [citizenId]` | ❌ | Opens the NPC profiles tab |
| `start <player> <questId>` | ✅ | Starts a quest for a player |
| `claim <player> <questId>` | ✅ | Claims a finished quest for a player |
| `complete <player> <questId>` | ✅ | Force-completes a quest |
| `reset <player> <questId>` | ✅ | Resets a quest for a player |
| `setstreak <player> <days>` | ✅ | Sets a player's streak |
| `resetdaily` | ✅ | Runs the daily reset now |
| `resetweekly` | ✅ | Runs the weekly reset now |
| `export <type> [id]` | ✅ | Exports quest data to `exports/` |
| `import <file> [overwrite]` | ✅ | Imports quest data from `exports/` (+ console node for console command rewards) |
| `test <questId> [player]` | ❌ | Starts a quest in test mode |
| `teststart`, `testfirstjoin`, `testzone <zone>`, `testnpc <npcId>` | ❌ | Test helpers |
| `resetme` | ❌ | Resets all your own quest data |
| `tokens [amount]` | ❌ | Gives you quest tokens |
| `debug`, `debugmode` | ❌ | Debug output |
| `spawnmerchant [npcType]`, `spawntemplemerchant [npcType]` | ❌ | Spawn a test NPC |

Older versions also checked the node `questbook.admin` in most admin subcommands. Quests 2.1 no longer uses it; `ks.quest.admin` alone is enough.

---

## Showcase mode

On a server running Core's showcase mode:

- **Visitors** may open the admin window and look at everything except player data. Nothing they do is saved, and the footer says "View only". The Players tab shows "Player data is hidden", also for visitors who hold `ks.quest.admin`.
- Admin subcommands that write data (`reload`, `start`, `complete`, `reset`, `setstreak`, `resetdaily`, `resetweekly`, `test`, `testzone`, `testnpc`, `tokens`, `debugmode`, `resetme`, `export`, `import`, the spawn commands) refuse to run for showcase accounts even with `ks.quest.admin`.
- The server console is not affected.

---

## Example setup (LuckPerms)

```
# Staff: Quests admin
lp group staff permission set ks.quest.admin true

# Head admins: may also edit console command rewards and NPC console actions
lp group headadmin permission set ks.core.admin.dialog.console true

# Lock the Questbook for a group (it is granted by default)
lp group guest permission set ks.quest.user.use false
```

:::tip
Give `ks.core.admin.dialog.console` only to people you would also give console access. A console command reward runs with every right on the server.
:::