AccessGuard
API reference › Debug › service › AccessGuard
Decides whether a request may reach the debugger.
The IP and host allowlists are evaluated first, so a denial by address never runs the application callback.
Properties
Section titled “Properties”| Property | Type | Description | Defined by |
|---|---|---|---|
$module protected readonly constructor | yii\ | Debug module read for the access configuration at call time. | AccessGuard |
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
__construct() | Binds access checks to the debug module. | AccessGuard |
allows() | Returns whether the request is allowed to reach the debugger. | AccessGuard |
Method details
Section titled “Method details”__construct()
Section titled “__construct() ”public function __construct(yii\debug\Module $module)Binds access checks to the debug module.
Parameters
| Parameter | Type | Description |
|---|---|---|
$module | yii\ | Debug module read for the access configuration at call time. |
allows()
Section titled “allows() ”public function allows(string $ip, yii\base\Action|null $action = null): boolReturns whether the request is allowed to reach the debugger.
Checks Module::$allowedIPs and Module::$allowedHosts, then the optional
Module::$checkAccessCallback, which grants access only by returning true. A denial is reported through
Yii::warning() unless the matching disable*RestrictionWarning flag is set.
Parameters
| Parameter | Type | Description |
|---|---|---|
$ip | string | Requesting IP address, or '' when the request carries none. |
$action | yii\| | Action being dispatched, or null outside an action context. |
Returns
bool: true when the request may reach the debugger; false otherwise.