# Permission Attachment

{% hint style="info" %}
Starting v2.7.0, this feature can only now be used through the [Player Delegate](/commandprompter/features/player-delegate.md) command.

If you want to execute commands as a console refer to [Console Delegate](/commandprompter/features/console-delegate.md).
{% endhint %}

Permission attachments allow players to have temporary access to command permissions. It's only available via player delegate to prevent a vulnerability when it's used as a prompt queue argument.

### How to use Permission Attachment

The general idea is to give players a set of permissions that you define in a very short amount of time. This permission set and the duration can be found and configured in `config.yml` under the `Permission Attachment` section.

#### **Step 1: Configuring permissions**

```yml
# Permission Attachment Config
# 
# Permission attachments allow players
# to have temporary permissions.
# 
# ticks - Set how long (in ticks) should the
#         permission attachment persist.
# 
# permissions - permissions to temporarily
#               attach to the players.
Permission-Attachment:
  ticks: 1
  Permissions:
    GAMEMODE:
    - bukkit.command.gamemode
    - essentials.gamemode
    - essentials.gamemode.survival
    - essentials.gamemode.creative
    
```

With the given configuration above, we defined a permission attachment called `GAMEMODE` to attach gamemode-related permission.

{% hint style="danger" %}
It's important that you only give permissions that you are willing to give to your players. I advise against putting permissions that allow your server to be compromised!
{% endhint %}

**Step 2: Using permission attachments in a prompt**

To use the permission attachment, we need to use it via the [Player Delegate](/commandprompter/features/player-delegate.md) like the following:

```
playerdelegate CyR1en GAMEMODE gamemode <what gamemode do you want?>
```

Once the player fulfilled the prompt, CommandPrompter will attach the permissions defined under GAMEMODE and dispatch the command, and remove the attached permissions afterward.


---

# 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://cyr1en.gitbook.io/commandprompter/features/permission-attachment.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.
