mirror of
https://github.com/flarum/core.git
synced 2025-08-16 05:14:20 +02:00
Removes AssertPermissionTrait (#90)
* Removes AssertPermissionTrait * Apply fixes from StyleCI Co-authored-by: luceos <daniel+github@klabbers.email>
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
namespace Flarum\Tags\Api\Controller;
|
||||
|
||||
use Flarum\Tags\Tag;
|
||||
use Flarum\User\AssertPermissionTrait;
|
||||
use Laminas\Diactoros\Response\EmptyResponse;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
@@ -18,14 +17,12 @@ use Psr\Http\Server\RequestHandlerInterface;
|
||||
|
||||
class OrderTagsController implements RequestHandlerInterface
|
||||
{
|
||||
use AssertPermissionTrait;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function handle(ServerRequestInterface $request): ResponseInterface
|
||||
{
|
||||
$this->assertAdmin($request->getAttribute('actor'));
|
||||
$request->getAttribute('actor')->assertAdmin();
|
||||
|
||||
$order = array_get($request->getParsedBody(), 'order');
|
||||
|
||||
|
@@ -12,12 +12,9 @@ namespace Flarum\Tags\Command;
|
||||
use Flarum\Tags\Event\Creating;
|
||||
use Flarum\Tags\Tag;
|
||||
use Flarum\Tags\TagValidator;
|
||||
use Flarum\User\AssertPermissionTrait;
|
||||
|
||||
class CreateTagHandler
|
||||
{
|
||||
use AssertPermissionTrait;
|
||||
|
||||
/**
|
||||
* @var TagValidator
|
||||
*/
|
||||
@@ -40,7 +37,7 @@ class CreateTagHandler
|
||||
$actor = $command->actor;
|
||||
$data = $command->data;
|
||||
|
||||
$this->assertCan($actor, 'createTag');
|
||||
$actor->assertCan('createTag');
|
||||
|
||||
$tag = Tag::build(
|
||||
array_get($data, 'attributes.name'),
|
||||
|
@@ -11,12 +11,9 @@ namespace Flarum\Tags\Command;
|
||||
|
||||
use Flarum\Tags\Event\Deleting;
|
||||
use Flarum\Tags\TagRepository;
|
||||
use Flarum\User\AssertPermissionTrait;
|
||||
|
||||
class DeleteTagHandler
|
||||
{
|
||||
use AssertPermissionTrait;
|
||||
|
||||
/**
|
||||
* @var TagRepository
|
||||
*/
|
||||
@@ -41,7 +38,7 @@ class DeleteTagHandler
|
||||
|
||||
$tag = $this->tags->findOrFail($command->tagId, $actor);
|
||||
|
||||
$this->assertCan($actor, 'delete', $tag);
|
||||
$actor->assertCan('delete', $tag);
|
||||
|
||||
event(new Deleting($tag, $actor));
|
||||
|
||||
|
@@ -12,12 +12,9 @@ namespace Flarum\Tags\Command;
|
||||
use Flarum\Tags\Event\TagWillBeSaved;
|
||||
use Flarum\Tags\TagRepository;
|
||||
use Flarum\Tags\TagValidator;
|
||||
use Flarum\User\AssertPermissionTrait;
|
||||
|
||||
class EditTagHandler
|
||||
{
|
||||
use AssertPermissionTrait;
|
||||
|
||||
/**
|
||||
* @var TagRepository
|
||||
*/
|
||||
@@ -50,7 +47,7 @@ class EditTagHandler
|
||||
|
||||
$tag = $this->tags->findOrFail($command->tagId, $actor);
|
||||
|
||||
$this->assertCan($actor, 'edit', $tag);
|
||||
$actor->assertCan('edit', $tag);
|
||||
|
||||
$attributes = array_get($data, 'attributes', []);
|
||||
|
||||
|
Reference in New Issue
Block a user