diff --git a/src/Rbac/Rbac.php b/src/Rbac/Rbac.php index a7be601..726e2e1 100644 --- a/src/Rbac/Rbac.php +++ b/src/Rbac/Rbac.php @@ -167,7 +167,11 @@ protected function _matchPermission(array $permission, $user, $role, ServerReque 'action' => $params['action'] ?? null, 'role' => $role, ]; - if (!$user && ($permission['bypassAuth'] ?? false) !== true) { + $bypass = $permission['bypassAuth'] ?? false; + if (is_callable($bypass)) { + $bypass = $bypass($user, $role, $request); + } + if (!$user && $bypass !== true) { return null; } foreach ($permission as $key => $value) {