mirror of
https://github.com/projectsend/projectsend.git
synced 2026-09-16 16:45:07 +00:00
6e47d76ba6
Client file sharing, rebuilt from the ground up: a private area per client, resumable uploads, folders, groups and categories, sharing with expiry dates and download limits, comments, file versions, an activity log, a REST API, and sixteen languages. This repository begins here. ProjectSend 2 was developed privately, and that development history is not published — the previous generation remains available, with its own history, at projectsend/legacy. Free software under the GNU General Public License v2, or (at your option) any later version.
32 lines
1.1 KiB
PHP
32 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Modules\Platform\Capabilities;
|
|
|
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
|
|
|
/**
|
|
* A request reached a route whose feature this edition does not have.
|
|
*
|
|
* Thrown rather than rendered, so the API's own error handler formats it:
|
|
* EnsureCapability used to build a JSON body by hand, which meant a
|
|
* capability refusal was the one API failure that was not an RFC 7807
|
|
* document — a caller parsing errors once would fail to parse this one.
|
|
* ProblemDetails maps it to a `capability_unavailable` type and keeps the
|
|
* `capability` and `edition` fields, so the machine-readable part
|
|
* survives.
|
|
*
|
|
* Web requests never see this: EnsureCapability still 404s there, because
|
|
* an unavailable feature should be absent rather than teased.
|
|
*/
|
|
final class CapabilityUnavailable extends HttpException
|
|
{
|
|
public function __construct(
|
|
public readonly Capability $capability,
|
|
public readonly Edition $edition,
|
|
) {
|
|
parent::__construct(403, 'This installation does not include '.$capability->value.'.');
|
|
}
|
|
}
|