Files
Leantime/app/Core/Exceptions/AuthorizationException.php
wangruiguo d647428529
Some checks failed
Security Audit / Composer Security Audit (push) Has been cancelled
Security Audit / NPM Security Audit (push) Has been cancelled
Security Audit / CodeQL Analysis (push) Has been cancelled
OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)
2026-09-03 18:49:20 +08:00

28 lines
865 B
PHP

<?php
namespace Leantime\Core\Exceptions;
use Throwable;
/**
* Thrown when an authenticated user is not allowed to perform an action or access a resource.
*
* Renders as HTTP 403 on the web/REST surfaces and JSON-RPC error -32001 (an
* implementation-defined code in the reserved -32000..-32099 range) on /api/jsonrpc.
*
* Services should throw this instead of returning `false`/`[]` on an authorization failure,
* so the denial is unambiguous (today `return []`/`return false` collide with "no results"
* and "not found").
*/
class AuthorizationException extends LeantimeException
{
protected int $statusCode = 403;
protected int $rpcCode = -32001;
public function __construct(string $message = 'You are not allowed to perform this action.', ?Throwable $previous = null)
{
parent::__construct($message, 0, $previous);
}
}