SuperUserAccessPolicyPass.php

Same filename in other branches
  1. 11.x core/lib/Drupal/Core/DependencyInjection/Compiler/SuperUserAccessPolicyPass.php

Namespace

Drupal\Core\DependencyInjection\Compiler

File

core/lib/Drupal/Core/DependencyInjection/Compiler/SuperUserAccessPolicyPass.php

View source
<?php

namespace Drupal\Core\DependencyInjection\Compiler;

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;

/**
 * Removes the super user access policy when toggled off.
 */
class SuperUserAccessPolicyPass implements CompilerPassInterface {
    
    /**
     * {@inheritdoc}
     */
    public function process(ContainerBuilder $container) : void {
        if ($container->getParameter('security.enable_super_user') === FALSE) {
            $container->removeDefinition('access_policy.super_user');
            $container->removeAlias('Drupal\\Core\\Session\\SuperUserAccessPolicy');
        }
    }

}

Classes

Title Deprecated Summary
SuperUserAccessPolicyPass Removes the super user access policy when toggled off.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.