# Permissions

## Permission Groups

The permission system in our admin menu is designed to be as flexible as possible. You can create custom permissions and set the default permission groups. Permission groups can also be viewed and edited from the UI. We created the permission group editor to make it easy to manage each group’s permissions and tiers.

{% embed url="<https://www.youtube.com/watch?v=9x54LX9qOqI>" %}

## How do I give myself permissions?

### CLI (Recommended)

The fastest way to give yourself access to the admin menu is through our CLI. Run `lc groups` to see all available groups, then use `lc give_access <server_id> <group_name>`.

You can check all CLI commands here: [cli](https://libertycode.gitbook.io/docs/lc_adminmenu/cli "mention")

{% code title="Server Console" %}

```
> lc groups

[script:lc_adminmenu] --------------------------------------------------
[script:lc_adminmenu] Group Name | Tier | Discord Role ID | Non Editable
[script:lc_adminmenu] --------------------------------------------------
[script:lc_adminmenu] owner      | 1    | Not Set         | True        
[script:lc_adminmenu] admin      | 2    | Not Set         | True        
[script:lc_adminmenu] trial      | 10   | Not Set         | True        
[script:lc_adminmenu] --------------------------------------------------
[script:lc_adminmenu] Use command "lc group <group_name>" to see the permissions of a group.
[script:lc_adminmenu] Use command "lc create_group <group_name> <tier>" to create a new group.
[script:lc_adminmenu] Use command "lc delete_group <group_name>" to delete a group.

> lc give_access 5 owner
[script:lc_adminmenu] Admin menu access granted to 5 with group owner
```

{% endcode %}

### ACE Permissions

You can give yourself access to the admin menu by granting yourself ACE permissions. The ACE permission you need uses this format: `lc_adminmenu.<group_name>`. Make sure the group name is correct and that a permission group with that name exists.

{% code title="server.cfg" overflow="wrap" %}

```
add_ace identifier.license:YOUR_LICENSE lc_adminmenu.owner allow
```

{% endcode %}

### Framework Integration

To synchronize the admin menu group with group from the framework, you need to edit the config\_server.lua and set the Permissions.Framework to true

{% code title="config\_server.lua" expandable="true" %}

```lua
return {
  ...,
  Permissions = {
    UseDatabase = true,
    UseAcePerms = false,
    UseDiscord = false,
    UseFramework = true -- CHANGE THIS FROM FALSE TO TRUE
  }
}

```

{% endcode %}

| Framework | Command                       |
| --------- | ----------------------------- |
| ESX       | /setgroup \[id] \[group]      |
| QBCore    | /addpermission \[id] \[group] |
| qbx-core  | ACE permissions only          |

## Custom Permissions

You can add your own permissions and manage them from the admin panel.

> **Okay, but what's the point of adding more permissions?**

You can add custom functions to the admin menu, and then each function can be restricted by custom permission.

Custom permissions can be added in the `data/permissions.lua` file.

{% code title="data/permissions.lua " %}

```lua
---@class Permission
---@field label string
---@field name string
---@field linked_ace_permission? string | string[]

---@type Permission[]
return {
  ...,
  {
    label = 'Custom permission',
    name = 'custom_permission'
  }
}
```

{% endcode %}

Now restart the script and you are ready to use your newly added permissions.

<div align="left"><figure><img src="https://2865522358-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8th5q7QOnHjL9q40xBgM%2Fuploads%2Fnua3C7nHIGGg6o6b67QK%2Fimage.png?alt=media&#x26;token=895fd710-daad-454b-b4e2-1d55df0e611d" alt=""><figcaption></figcaption></figure></div>

## Linking ACE permissions

You can link ACE permissions to each Admin Menu permission, giving you tight control over what each admin can access. For example, you can restrict the `/revive` and `/heal` command so only admins with a permission group that includes the `revive` permission can use it.

{% code title="data/permissions.lua" %}

```lua
---@class Permission
---@field label string
---@field name string
---@field linked_ace_permission? string | string[]

---@type Permission[]
return {
  ...,
  {
    label = 'Revive',
    name = 'revive',
    linked_ace_permission = {
      'command.revive',
      'command.heal',
    }
  }
}
```

{% endcode %}


---

# 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://libertycode.gitbook.io/docs/lc_adminmenu/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.
