mirror of
https://github.com/flarum/core.git
synced 2025-10-13 07:54:25 +02:00
44 lines
1.0 KiB
PHP
44 lines
1.0 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Flarum.
|
|
*
|
|
* For detailed copyright and license information, please view the
|
|
* LICENSE file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Flarum\Api\Controller;
|
|
|
|
use Flarum\Api\Serializer\MailDriverSerializer;
|
|
use Flarum\User\AssertPermissionTrait;
|
|
use Psr\Http\Message\ServerRequestInterface;
|
|
use Tobscure\JsonApi\Document;
|
|
|
|
class ListMailDriversController extends AbstractListController
|
|
{
|
|
use AssertPermissionTrait;
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public $serializer = MailDriverSerializer::class;
|
|
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
protected function data(ServerRequestInterface $request, Document $document)
|
|
{
|
|
$this->assertAdmin($request->getAttribute('actor'));
|
|
|
|
$drivers = self::$container->make('mail.supported_drivers');
|
|
array_walk($drivers, function (&$driver, $key) {
|
|
$driver = [
|
|
'id' => $key,
|
|
'driver' => self::$container->make($driver),
|
|
];
|
|
});
|
|
|
|
return $drivers;
|
|
}
|
|
}
|