File "CanEditPosts.php"

Full Path: /home/u886502366/domains/almoasronppbags.com/public_html/newtest/wp-content/plugins/depicter/vendor/typerocket/core/src/Http/Middleware/CanEditPosts.php
File size: 501 bytes
MIME-type: text/x-php
Charset: utf-8

<?php
namespace TypeRocket\Http\Middleware;

use TypeRocket\Exceptions\HttpError;

/**
 * Class OwnsPostOrCanEditPosts
 *
 * Validate that user can owns post or can edit posts and
 * if the user is not invalidate the response.
 *
 * @package TypeRocket\Http\Middleware
 */
class CanEditPosts extends Middleware
{
    public function handle() {

        if( ! $this->isHook() && ! current_user_can( 'edit_posts' ) ) {
            HttpError::abort(401);
        }

        $this->next->handle();
    }
}