<commit_before><?php

namespace Bolt\Controllers;

use Silex;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Bolt\Library as Lib;
use Bolt\Helpers\String;
use Bolt\Helpers\Input;
use Bolt\Translation\Translator as Trans;
use Bolt\Pager;

/**
 * Standard Frontend actions
 *
 * This file acts as a grouping for the default front-end controllers.
 *
 * For overriding the default behavior here, please reference
 * http://docs.bolt.cm/templates-routes#routing or the routing.yml
 * file in your configuration.
 */
class Frontend
{
    /**
     * Perform contenttype-based permission check, aborting with a 403
     * Forbidden as appropriate.
     *
     * @param Silex\Application    $app     The application/container
     * @param \Bolt\Content|string $content The content to check
     */
    private static function checkFrontendPermission(Silex\Application $app, $content)
    {
        if ($app['config']->get('general/frontend_permission_checks')) {
            if ($content instanceof \Bolt\Content) {
                $contenttypeslug = $content->contenttype['slug'];
                $contentid = $content['id'];
            } else {
                $contenttypeslug = (string) $content;
                $contentid = null;
            }
            if (!$app['users']->isAllowed('frontend', $contenttypeslug, $contentid)) {
                $app->abort(403, 'Not allowed.');
            }
        }<commit_msg>Changed visibility of the frontend permission check so derived classes can keep using this.<commit_after><?php

namespace Bolt\Controllers;

use Silex;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Bolt\Library as Lib;
use Bolt\Helpers\String;
use Bolt\Helpers\Input;
use Bolt\Translation\Translator as Trans;
use Bolt\Pager;

/**
 * Standard Frontend actions
 *
 * This file acts as a grouping for the default front-end controllers.
 *
 * For overriding the default behavior here, please reference
 * http://docs.bolt.cm/templates-routes#routing or the routing.yml
 * file in your configuration.
 */
class Frontend
{
    /**
     * Perform contenttype-based permission check, aborting with a 403
     * Forbidden as appropriate.
     *
     * @param Silex\Application    $app     The application/container
     * @param \Bolt\Content|string $content The content to check
     */
    protected static function checkFrontendPermission(Silex\Application $app, $content)
    {
        if ($app['config']->get('general/frontend_permission_checks')) {
            if ($content instanceof \Bolt\Content) {
                $contenttypeslug = $content->contenttype['slug'];
                $contentid = $content['id'];
            } else {
                $contenttypeslug = (string) $content;
                $contentid = null;
            }
            if (!$app['users']->isAllowed('frontend', $contenttypeslug, $contentid)) {
                $app->abort(403, 'Not allowed.');
            }
        }
{'fraction_non_alphanumeric': 0.11055776892430279, 'fraction_numerical': 0.00398406374501992, 'mean_word_length': 2.7335811648079305, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4484947', 'n_tokens_mistral': 855, 'n_tokens_neox': 841, 'n_words': 227}