# fluent-support/2.2.0/app/Http/Controllers/Controller.php

Fluent Support – Helpdesk &amp; Customer Support Ticket System, version 2.2.0. 44 lines.

- Page: https://pluginprobe.com/plugins/fluent-support/2.2.0/code/app/Http/Controllers/Controller.php
- Raw: https://pluginprobe.com/plugins/fluent-support/2.2.0/raw/app/Http/Controllers/Controller.php
- Modified: 2026-03-02T12:47:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-support/2.2.0/code/app/Http/Controllers/Controller.php#L10-L20`.

```php
<?php

namespace FluentSupport\App\Http\Controllers;

use FluentSupport\App\Modules\PermissionManager;
use FluentSupport\Framework\Http\Controller as BaseController;

abstract class Controller extends BaseController
{
    /**
     * Ensure the current agent has at least one ticket management permission.
     * Draft-only agents (fst_draft_reply only) cannot perform mutating actions.
     *
     * @throws \Exception
     */
    protected function ensureCanManageTickets()
    {
        if (PermissionManager::canManageTickets()) {
            return;
        }

        throw new \Exception(
            esc_html__('You do not have permission to perform this action.', 'fluent-support')
        );
    }

    /**
     * Ensure the current agent can access the given ticket based on visibility level.
     *
     * @param object $ticket
     * @throws \Exception
     */
    protected function ensureCanAccessTicket($ticket)
    {
        if (PermissionManager::canAccessTicket($ticket)) {
            return;
        }

        throw new \Exception(
            esc_html__('Sorry, You do not have permission to this ticket', 'fluent-support')
        );
    }
}

```
