{"record":{"id":"6966fc1227a45c21","repo":"krayin/laravel-crm","slug":"admin-app-errors-unauthorized","errorCode":"admin::app.errors.unauthorized","errorMessage":"This action is unauthorized.","messagePattern":"This action is unauthorized\\.","errorType":"http","errorClass":null,"httpStatus":401,"severity":"error","filePath":"packages/Webkul/Admin/src/Http/Controllers/Controller.php","lineNumber":40,"sourceCode":"        return redirect()->route('admin.session.create');\n    }\n\n    /**\n     * Prevent access to a record that is not owned by (or shared with) the current user.\n     *\n     * @param  int|array|null  $ownerIds  The user id (or ids, e.g. owner + participants) tied to the record.\n     * @return void\n     */\n    protected function preventUnauthorizedAccess($ownerIds)\n    {\n        $userIds = bouncer()->getAuthorizedUserIds();\n\n        if ($userIds === null) {\n            return;\n        }\n\n        if (empty(array_intersect((array) $ownerIds, $userIds))) {\n            abort(401, trans('admin::app.errors.unauthorized'));\n        }\n    }\n\n    /**\n     * Filter a collection of records down to the ones the current user is authorized to manage.\n     *\n     * @param  Collection  $records\n     * @param  callable|null  $ownerIdsResolver  Resolves the owning user id(s) for a record; defaults to `user_id`.\n     * @return Collection\n     */\n    protected function filterAuthorizedRecords($records, ?callable $ownerIdsResolver = null)\n    {\n        $userIds = bouncer()->getAuthorizedUserIds();\n\n        if ($userIds === null) {\n            return $records;\n        }\n","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/krayin/laravel-crm/blob/13d6988cda8d69ece45ee1890effc90a7f21cdc1/packages/Webkul/Admin/src/Http/Controllers/Controller.php#L22-L58","documentation":"Error \"This action is unauthorized.\" thrown in krayin/laravel-crm.","triggerScenarios":"Thrown at packages/Webkul/Admin/src/Http/Controllers/Controller.php:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"13d6988cda8d69ece45ee1890effc90a7f21cdc1","analyzedAt":"2026-08-17T00:58:29.000Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}