# Manage Roles and Permissions

{% hint style="warning" %} <mark style="color:red;">**configs/plugins/DU\_ManageRolesAndPermissions/DU\_ManageRolesAndPermissions.json**</mark>
{% endhint %}

{% hint style="info" %}
You have a choice of two methods. In both methods, the player must have a [linked account](https://docs.sourcefactory.eu/discord-utilities/main-configuration/linking-system)!

> 1. <mark style="color:green;">**Role To Permission:**</mark>\
>    When a player connects and has a certain role on the discord server, he gets a certain flags, immunity and command overrides on the C2 server.

> 2. <mark style="color:green;">**Permission To Role:**</mark>\
>    When a player connects to the server and has a certain permission (flag/group), he gets a certain role on your Discord server. (The role will remain even if he disconnects from the CS2 server)&#x20;

•<mark style="color:yellow;">**`Remove Roles On Permission Loss`**</mark>\
This means that if a player no longer has the specified permission (flag/group), the role will be automatically removed.
{% endhint %}

{% hint style="success" %}
You can use this for example for VIP or Admin players, when they join they get a permission or role according to your settings.\
\
It's not limited to just 2x Roles To Permission or Permission To Roles, you can add any other values you need. The default config contains only two sample configurations.
{% endhint %}

### Examples:

```json
{
  "Remove Roles On Permission Loss": false, // If a player joins and doesn't have a certain Permission from Permission To Role, and if they don't have that role, it will be automatically removed
  "Remove Permissions On Role Loss" : false, // This means that if a player is removed from a role and is connected on the server, a permissions from that role will be removed immediately
  "Role To Permission": {
    "123456789": {
      "flags": [
        "@css/kick",
        "@css/ban"
      ],
      "immunity": 100,
      "command_overrides": {
        "css_respawn": true
      }
    },
    "987654321": {
      "flags": [
        "@css/ban",
        "@css/kick"
      ],
      "immunity": 90,
      "command_overrides": {
        "css_slay": true
      }
    }
  },
  "Permission To Role": {
    "Flag or Group": "ROLE ID",
    "@css/vip_flag": "321654987", // PLAYERS WILL GET ROLE ON THE DISCORD SERVER: 321654987 IF THEY HAVE FLAG @css/vip_flag
    "#css/admin": "789456123" // PLAYERS WILL GET ROLE ON THE DISCORD SERVER: 789456123IF IF THEY HAVE GROUP #css/admin
    //and more...
  },
  "ConfigVersion": 1
}
```

> Some information about flags: <https://docs.cssharp.dev/docs/admin-framework/defining-admin-groups.html>

***

{% hint style="danger" %} <mark style="color:red;">**CAUTION**</mark>\
• Your Discord BOT role must always be above your Managed Role! Otherwise roles will not be added.\
• Only CSS permissions work, you can't use flags or groups from metamod plugins
{% endhint %}

<div align="left"><figure><img src="https://799349702-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FrczaiIR8LCIvnID1U1Ty%2Fuploads%2FZplZuAYBSF3jbX4jxRBZ%2Fmustbeupper.png?alt=media&#x26;token=ab4b1074-37dc-415b-bb11-907009557b64" alt="" width="341"><figcaption></figcaption></figure></div>


---

# 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://docs.sourcefactory.eu/discord-utilities/modules/manage-roles-and-permissions.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.
