@param string $configKey

@throws AccessDeniedException
977977
public function checkGenericAccess($configKey)
    {
        $config = $this->app->make('community_translation/config');
        $level = $config->get('options.api.access.' . $configKey);
        switch ($level) {
            case self::ACCESSOPTION_EVERYBODY:
                return;
            case self::ACCESSOPTION_REGISTEREDUSERS:
                $this->getRequestUser();

                return;
            case self::ACCESSOPTION_TRANSLATORS:
                $requiredLevel = Access::TRANSLATE;
                break;
            case self::ACCESSOPTION_LOCALEADMINS:
                $requiredLevel = Access::ADMIN;
                break;
            case self::ACCESSOPTION_GLOBALADMINS:
                $requiredLevel = Access::GLOBAL_ADMIN;
                break;
            case self::ACCESSOPTION_SITEADMINS:
                $user = $this->getRequestUser();
                if ($user->getUserID() != USER_SUPER_ID) {
                    $admins = Group::getByID(ADMIN_GROUP_ID);
                    if (!$admins || !$user->inGroup($admins)) {
                        throw AccessDeniedException::create();
                    }
                }

                return;
            case self::ACCESSOPTION_ROOT:
                $user = $this->getRequestUser();
                if ($user->getUserID() != USER_SUPER_ID) {
                    throw AccessDeniedException::create();
                }

                return;
            case self::ACCESSOPTION_NOBODY:
            default:
                throw AccessDeniedException::create();
        }
        $user = $this->getRequestUser();
        $hasRequiredLevel = false;
        foreach ($this->getApprovedLocales() as $locale) {
            if ($this->getAccessHelper()->getLocaleAccess($locale, $user) >= $requiredLevel) {
                $hasRequiredLevel = true;
                break;
            } elseif ($requiredLevel >= Access::GLOBAL_ADMIN) {
                break;
            }
        }
        if ($hasRequiredLevel !== true) {
            throw AccessDeniedException::create();
        }
    }
261505
protected function removeAdditionalConfiguration($extensionKey)
    {
        $newLines = $this->getCleanAdditionalConfiguration($extensionKey);

        if (empty($newLines) !== true)
        {
            $this->getConfigurationManager()->writeAdditionalConfiguration($newLines);

            /**
             * Add Flashmessage that the configuration has written
             */
            $this->showFlashMessage(
                'Configuration successfully removed from ' .
                $this->getConfigurationManager()->getAdditionalConfigurationFileLocation() .
                '.',
                'Configuration removed',
                FlashMessage::OK,
                true
            );
        }
        else
        {
            unlink($this->getConfigurationManager()->getAdditionalConfigurationFileLocation());

            /**
             * Add Flashmessage that the configuration has deleted
             */
            $this->showFlashMessage(
                'File ' . $this->getConfigurationManager()->getAdditionalConfigurationFileLocation() . ' successfully deleted.',
                'Configuration delete',
                FlashMessage::OK,
                true
            );
        }
    }
430666
public function removeAccessLevel($key)
    {
        if (!isset($this->accessLevels[$key])) {
            return false;
        }
        
        // Remove the access level
        unset($this->accessLevels[$key]);
        
        // Save the access levels
        $this->saveAccessLevels();
        
        // Revoke all permissions for the given access level key
        $runtimeManager = $this->framework->getRuntimeManager();
        $runtimeManager->executeFilter('\\Zepi\\Core\\AccessControl\\Filter\\AccessLevelManager\\RemoveAccessLevel', $key);
    }
402313
protected function compile(): void
    {
        $metaModel = $this->factory->translateIdToMetaModelName($this->metamodel);

        try {
            $this->Template->editor = $this->editor->editFor($metaModel, 'create');
        } catch (NotEditableException $exception) {
            throw new AccessDeniedException($exception->getMessage());
        } catch (NotCreatableException $exception) {
            throw new AccessDeniedException($exception->getMessage());
        }
    }
1127904
public function setEditor($key)
    {
        $this->setEditor = (isset($this->editors[$key])) ? $key : null;
    }
834389
public function clearAction(Request $request)
    {
        if (!$this->getParameter('kernel.debug')) {
            throw new AccessDeniedException('You should be in debug mode to access this feature');
        }
        $this->get('victoire_widget.widget_cache')->clear();

        return $this->redirect($request->headers->get('referer'));
    }
677913
private function isValidConfigs(array $configs): void
    {
        $allowedConfigKeys = $this->getAllowedConfigKeys();
        if (!empty($configs)) {
            foreach ($configs as $key => $value) {
                if (!\in_array($key, $allowedConfigKeys, true)) {
                    throw new InvalidKeyException(sprintf(
                        '%s is not a valid key. configs must only contain "%s".',
                        $key,
                        implode(', ', $allowedConfigKeys)
                    ));
                }

                $this->isBool($key, $value);
                $this->isString($key, $value);
                $this->isValidNBest($key, $value);
            }
        }
    }
638368
protected function checkAction($action, $configKey)
    {
        $actions = (array)$this->getConfig($configKey);

        return in_array($action, $actions, true);
    }
80770
public function clearKey($nsKey, $itemKey)
    {
        if ($this->hasKey($nsKey, $itemKey)) {
            $this->freeHandle($nsKey, $itemKey);
            unlink($this->path.'/'.$nsKey.'/'.$itemKey);
        }
    }
91516
final public static function getConfig($key = null)
    {
        $calledClass = get_called_class();

        // Load config
        if (!isset(self::$loadedConfigSet[$calledClass]) || null === self::$loadedConfigSet[$calledClass]) {
            self::$loadedConfigSet[$calledClass] = array_merge(self::$configDefault, static::loadConfig());
        }

        // Get config property
        return (null === $key)
            ? self::$loadedConfigSet[$calledClass]
            : self::$loadedConfigSet[$calledClass][$key];
    }
663940
public function useKeyAsIndex($key, $normalize = false)
    {
        if (null === $key) {
            $this->indexKey = null;
            return;
        }

        if (true !== $normalize && !$this->isValidNodeName($key)) {
            throw new \InvalidArgumentException(sprintf('%s is an invalid node name', $key));
        }

        $this->indexKey = $normalize ? $this->normalizer->normalize($key) : $key;
    }
1084559
protected function _getGumballConfig($configKey) {
        if (!$this->_gumballConfig) {
            $this->_gumballConfig = new Garp_Config_Ini(APPLICATION_PATH . '/configs/gumball.ini');
        }
        return $this->_gumballConfig->gumball->{$configKey};
    }
1229297
public function composeAction(Request $request = null)
    {
        $this->admin->checkAccess('compose');
        if (false === $this->get('sonata.page.admin.block')->isGranted('LIST')) {
            throw new AccessDeniedException();
        }

        $id = $request->get($this->admin->getIdParameter());
        $page = $this->admin->getObject($id);
        if (!$page) {
            throw new NotFoundHttpException(sprintf('unable to find the page with id : %s', $id));
        }

        $containers = [];
        $orphanContainers = [];
        $children = [];

        $templateManager = $this->get('sonata.page.template_manager');
        $template = $templateManager->get($page->getTemplateCode());
        $templateContainers = $template->getContainers();

        foreach ($templateContainers as $id => $container) {
            $containers[$id] = [
                'area' => $container,
                'block' => false,
            ];
        }

        // 'attach' containers to corresponding template area, otherwise add it to orphans
        foreach ($page->getBlocks() as $block) {
            $blockCode = $block->getSetting('code');
            if (null === $block->getParent()) {
                if (isset($containers[$blockCode])) {
                    $containers[$blockCode]['block'] = $block;
                } else {
                    $orphanContainers[] = $block;
                }
            } else {
                $children[] = $block;
            }
        }

        // searching for block defined in template which are not created
        $blockInteractor = $this->get('sonata.page.block_interactor');

        foreach ($containers as $id => $container) {
            if (false === $container['block'] && false === $templateContainers[$id]['shared']) {
                $blockContainer = $blockInteractor->createNewContainer([
                    'page' => $page,
                    'name' => $templateContainers[$id]['name'],
                    'code' => $id,
                ]);

                $containers[$id]['block'] = $blockContainer;
            }
        }

        return $this->render($this->admin->getTemplate('compose'), [
            'object' => $page,
            'action' => 'edit',
            'template' => $template,
            'page' => $page,
            'containers' => $containers,
            'orphanContainers' => $orphanContainers,
            'csrfTokens' => [
                'remove' => $this->getCsrfToken('sonata.delete'),
            ],
        ]);
    }
789435
public static function additionalConfiguration($extensionKey)
    {
        // Get the configuration
        $extConf = self::getSanitizedExtConf($extensionKey);

        if ($extConf['cachingConfigEnable'] == 1) {
            self::handleCachingConfiguration($extConf);
        }
    }
144562
public function onLoadCallback(DataContainer $dc)
    {
        if (!$this->permissionChecker->canUserManageCategories() && !$this->permissionChecker->canUserAssignCategories()) {
            throw new AccessDeniedException('User has no permissions to manage news categories');
        }

        // Disable some features if user is not allowed to manage categories
        if (!$this->permissionChecker->canUserManageCategories()) {
            $GLOBALS['TL_DCA'][$dc->table]['config']['closed'] = true;
            $GLOBALS['TL_DCA'][$dc->table]['config']['notEditable'] = true;
            $GLOBALS['TL_DCA'][$dc->table]['config']['notDeletable'] = true;
            $GLOBALS['TL_DCA'][$dc->table]['config']['notCopyable'] = true;
            $GLOBALS['TL_DCA'][$dc->table]['config']['notSortable'] = true;

            unset($GLOBALS['TL_DCA'][$dc->table]['list']['global_operations']['all']);

            $GLOBALS['TL_DCA'][$dc->table]['list']['operations'] = array_intersect_key(
                $GLOBALS['TL_DCA'][$dc->table]['list']['operations'],
                array_flip(['show'])
            );
        }

        /** @var Input $input */
        $input = $this->framework->getAdapter(Input::class);

        // Get the news categories root set previously in session (see #137)
        if (isset($_SESSION['NEWS_CATEGORIES_ROOT']) && $input->get('picker')) {
            $GLOBALS['TL_DCA'][$dc->table]['list']['sorting']['root'] = $_SESSION['NEWS_CATEGORIES_ROOT'];
            unset($_SESSION['NEWS_CATEGORIES_ROOT']);
        } else {
            unset($GLOBALS['TL_DCA'][$dc->table]['list']['sorting']['root']);
        }

        // Limit the allowed roots for the user
        if (null !== ($roots = $this->permissionChecker->getUserAllowedRoots())) {
            if (isset($GLOBALS['TL_DCA'][$dc->table]['list']['sorting']['root']) && is_array($GLOBALS['TL_DCA'][$dc->table]['list']['sorting']['root'])) {
                $GLOBALS['TL_DCA'][$dc->table]['list']['sorting']['root'] = array_intersect($GLOBALS['TL_DCA'][$dc->table]['list']['sorting']['root'], $roots);
            } else {
                $GLOBALS['TL_DCA'][$dc->table]['list']['sorting']['root'] = $roots;
            }

            // Check current action
            switch ($action = $input->get('act')) {
                case 'edit':
                    $categoryId = (int) $input->get('id');

                    // Dynamically add the record to the user profile
                    if (!$this->permissionChecker->isUserAllowedNewsCategory($categoryId)) {
                        /** @var \Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface $sessionBag */
                        $sessionBag = $this->session->getbag('contao_backend');

                        $newRecords = $sessionBag->get('new_records');
                        $newRecords = \is_array($newRecords[$dc->table]) ? \array_map('intval', $newRecords[$dc->table]) : [];

                        if (\in_array($categoryId, $newRecords, true)) {
                            $this->permissionChecker->addCategoryToAllowedRoots($categoryId);
                        }
                    }
                // no break;

                case 'copy':
                case 'delete':
                case 'show':
                    $categoryId = (int) $input->get('id');

                    if (!$this->permissionChecker->isUserAllowedNewsCategory($categoryId)) {
                        throw new AccessDeniedException(\sprintf('Not enough permissions to %s news category ID %s.', $action, $categoryId));
                    }
                    break;
                case 'editAll':
                case 'deleteAll':
                case 'overrideAll':
                    $session = $this->session->all();
                    $session['CURRENT']['IDS'] = \array_intersect($session['CURRENT']['IDS'], $roots);
                    $this->session->replace($session);
                    break;
            }
        }
    }
786256
public function setAccessKey( $accessKey ) {
		$accessKey = is_string( $accessKey ) && strlen( $accessKey ) ? $accessKey : null;

		if ( $this->accessKey !== $accessKey ) {
			if ( $accessKey !== null ) {
				$this->accessKeyed->setAttributes( [ 'accesskey' => $accessKey ] );
			} else {
				$this->accessKeyed->removeAttributes( [ 'accesskey' ] );
			}
			$this->accessKey = $accessKey;

			// Only if this is a TitledElement
			if ( method_exists( $this, 'updateTitle' ) ) {
				$this->updateTitle();
			}
		}

		return $this;
	}
828054
public function setConfigStruct(string $configKey, ConfigStruct $configStruct): void
    {
        $this->configStructs[$configKey] = $configStruct;
    }