Skip to main content

PermissionsHandler

Shared permissions handler that works on both client and server. The actual data storage and networking is handled by the respective CmdrServer and CmdrClient implementations.

Functions

PlayerHasPermissionForCommand

PermissionsHandler:PlayerHasPermissionForCommand(
plrPlayer,--

The player to check permissions for

commandNamestring--

The name of the command to check

) → boolean--

Whether the player has permission

Checks if a player has permission to run a command

GetPlayerPermissionGroups

PermissionsHandler:GetPlayerPermissionGroups(
plrPlayer--

The player to get permissions for

) → {string}--

Array of permission group names

Gets the permission groups for a player

SetPlayerPermissionGroups

PermissionsHandler:SetPlayerPermissionGroups(
plrPlayer,--

The player to set permissions for

permissionsstring | {string}--

The permission group(s) to set

) → ()

Sets the direct permissions for a player. Does not override inherited permissions or group permissions.

GivePlayerPermissionGroups

PermissionsHandler:GivePlayerPermissionGroups(
plrPlayer,--

The player to grant permissions to

permissionGroupsstring | {string}--

The permission groups to grant

) → ()

Grants a player permission group(s). Adds the given permissions to the player's current permissions.

GetRobloxGroupRankPermissionGroups

PermissionsHandler:GetRobloxGroupRankPermissionGroups(
robloxGroupIdnumber,--

The Roblox group id to get permissions for

ranknumber--

The rank to get permissions for

) → {string}--

The permission groups granted to the rank

Gets the permissions granted to a particular rank in a group.

GiveRobloxGroupRankPermissionGroups

PermissionsHandler:GiveRobloxGroupRankPermissionGroups(
robloxGroupIdnumber,--

The Roblox group id to grant permissions to

ranksnumber | NumberRange,--

The ranks to apply the permissions to. Can be a single rank or a range of ranks.

permissionGroupsstring | {string}--

The permissions to grant to the group

) → function--

A function that can be called to remove the permissions

Grants specified ranks in a Roblox Group permission to use the commands under a given PermissionGroup.

GiveRobloxGroupRolePermissionGroups

PermissionsHandler:GiveRobloxGroupRolePermissionGroups(
robloxGroupIdnumber,--

The Roblox group id to grant permissions to

rolestring,--

The role name to grant permissions to

permissionGroupsstring | {string}--

The permission groups to grant

) → function--

A function that can be called to remove the permissions

Grants specified roles in a Roblox Group permission to use commands under a given PermissionGroup.

SetPermissionGroupInheritance

PermissionsHandler:SetPermissionGroupInheritance(
permissionGroupstring,--

The permission group to set the inheritance for

inheritedGroupsstring | {string}--

The group(s) to inherit permissions from

) → ()

Sets the permission inheritance for a permission group.

GetPermissionInheritance

PermissionsHandler:GetPermissionInheritance(
permissionGroupstring--

The permission group to get inheritance for

) → {string}--

Array of inherited permission groups

Fetches the inherited Permission Group(s) for a given Permission Group

GetCommandsAvailableToPermissionGroup

PermissionsHandler:GetCommandsAvailableToPermissionGroup(
permissionGroupstring--

The permission group to get commands for

) → {string}--

Array of command names

Gets all commands available to a permission group

Show raw api
{
    "functions": [
        {
            "name": "SetCmdrRegistry",
            "desc": "Sets the Cmdr registry reference for command lookups",
            "params": [
                {
                    "name": "registry",
                    "desc": "The Cmdr registry instance",
                    "lua_type": "any"
                }
            ],
            "returns": [],
            "function_type": "method",
            "private": true,
            "source": {
                "line": 71,
                "path": "lib/cmdrhandler/src/Shared/PermissionsHandler.luau"
            }
        },
        {
            "name": "PlayerHasPermissionForCommand",
            "desc": "Checks if a player has permission to run a command",
            "params": [
                {
                    "name": "plr",
                    "desc": "The player to check permissions for",
                    "lua_type": "Player"
                },
                {
                    "name": "commandName",
                    "desc": "The name of the command to check",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "Whether the player has permission",
                    "lua_type": "boolean"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 81,
                "path": "lib/cmdrhandler/src/Shared/PermissionsHandler.luau"
            }
        },
        {
            "name": "GetPlayerPermissionGroups",
            "desc": "Gets the permission groups for a player",
            "params": [
                {
                    "name": "plr",
                    "desc": "The player to get permissions for",
                    "lua_type": "Player"
                }
            ],
            "returns": [
                {
                    "desc": "Array of permission group names",
                    "lua_type": "{string}"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 106,
                "path": "lib/cmdrhandler/src/Shared/PermissionsHandler.luau"
            }
        },
        {
            "name": "SetPlayerPermissionGroups",
            "desc": "Sets the direct permissions for a player.\nDoes not override inherited permissions or group permissions.",
            "params": [
                {
                    "name": "plr",
                    "desc": "The player to set permissions for",
                    "lua_type": "Player"
                },
                {
                    "name": "permissions",
                    "desc": "The permission group(s) to set",
                    "lua_type": "string | { string }"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 117,
                "path": "lib/cmdrhandler/src/Shared/PermissionsHandler.luau"
            }
        },
        {
            "name": "GivePlayerPermissionGroups",
            "desc": "Grants a player permission group(s). Adds the given permissions to the player's current permissions.",
            "params": [
                {
                    "name": "plr",
                    "desc": "The player to grant permissions to",
                    "lua_type": "Player"
                },
                {
                    "name": "permissionGroups",
                    "desc": "The permission groups to grant",
                    "lua_type": "string | { string }"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 130,
                "path": "lib/cmdrhandler/src/Shared/PermissionsHandler.luau"
            }
        },
        {
            "name": "GetRobloxGroupRankPermissionGroups",
            "desc": "Gets the permissions granted to a particular rank in a group.",
            "params": [
                {
                    "name": "robloxGroupId",
                    "desc": "The Roblox group id to get permissions for",
                    "lua_type": "number"
                },
                {
                    "name": "rank",
                    "desc": "The rank to get permissions for",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "The permission groups granted to the rank",
                    "lua_type": "{string}"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 150,
                "path": "lib/cmdrhandler/src/Shared/PermissionsHandler.luau"
            }
        },
        {
            "name": "GiveRobloxGroupRankPermissionGroups",
            "desc": "Grants specified ranks in a Roblox Group permission to use the commands under a given PermissionGroup.",
            "params": [
                {
                    "name": "robloxGroupId",
                    "desc": "The Roblox group id to grant permissions to",
                    "lua_type": "number"
                },
                {
                    "name": "ranks",
                    "desc": "The ranks to apply the permissions to. Can be a single rank or a range of ranks.",
                    "lua_type": "number | NumberRange"
                },
                {
                    "name": "permissionGroups",
                    "desc": "The permissions to grant to the group",
                    "lua_type": "string | { string }\n"
                }
            ],
            "returns": [
                {
                    "desc": "A function that can be called to remove the permissions",
                    "lua_type": "function"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 161,
                "path": "lib/cmdrhandler/src/Shared/PermissionsHandler.luau"
            }
        },
        {
            "name": "GiveRobloxGroupRolePermissionGroups",
            "desc": "Grants specified roles in a Roblox Group permission to use commands under a given PermissionGroup.",
            "params": [
                {
                    "name": "robloxGroupId",
                    "desc": "The Roblox group id to grant permissions to",
                    "lua_type": "number"
                },
                {
                    "name": "role",
                    "desc": "The role name to grant permissions to",
                    "lua_type": "string"
                },
                {
                    "name": "permissionGroups",
                    "desc": "The permission groups to grant",
                    "lua_type": "string | { string }\n"
                }
            ],
            "returns": [
                {
                    "desc": "A function that can be called to remove the permissions",
                    "lua_type": "function"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 217,
                "path": "lib/cmdrhandler/src/Shared/PermissionsHandler.luau"
            }
        },
        {
            "name": "SetPermissionGroupInheritance",
            "desc": "Sets the permission inheritance for a permission group.",
            "params": [
                {
                    "name": "permissionGroup",
                    "desc": "The permission group to set the inheritance for",
                    "lua_type": "string"
                },
                {
                    "name": "inheritedGroups",
                    "desc": "The group(s) to inherit permissions from",
                    "lua_type": "string | { string }"
                }
            ],
            "returns": [],
            "function_type": "method",
            "source": {
                "line": 274,
                "path": "lib/cmdrhandler/src/Shared/PermissionsHandler.luau"
            }
        },
        {
            "name": "GetPermissionInheritance",
            "desc": "Fetches the inherited Permission Group(s) for a given Permission Group",
            "params": [
                {
                    "name": "permissionGroup",
                    "desc": "The permission group to get inheritance for",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "Array of inherited permission groups",
                    "lua_type": "{string}"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 289,
                "path": "lib/cmdrhandler/src/Shared/PermissionsHandler.luau"
            }
        },
        {
            "name": "GetCommandsAvailableToPermissionGroup",
            "desc": "Gets all commands available to a permission group",
            "params": [
                {
                    "name": "permissionGroup",
                    "desc": "The permission group to get commands for",
                    "lua_type": "string"
                }
            ],
            "returns": [
                {
                    "desc": "Array of command names",
                    "lua_type": "{string}"
                }
            ],
            "function_type": "method",
            "source": {
                "line": 298,
                "path": "lib/cmdrhandler/src/Shared/PermissionsHandler.luau"
            }
        },
        {
            "name": "_getRawGroupPerms",
            "desc": "Gets the raw group rank permissions (used by CmdrUtil)",
            "params": [
                {
                    "name": "groupId",
                    "desc": "The group ID to get permissions for (can be number or string)",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "Raw group permission data",
                    "lua_type": "{any}"
                }
            ],
            "function_type": "method",
            "private": true,
            "source": {
                "line": 319,
                "path": "lib/cmdrhandler/src/Shared/PermissionsHandler.luau"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "PermissionsHandler",
    "desc": "Shared permissions handler that works on both client and server.\nThe actual data storage and networking is handled by the respective\nCmdrServer and CmdrClient implementations.",
    "source": {
        "line": 10,
        "path": "lib/cmdrhandler/src/Shared/PermissionsHandler.luau"
    }
}