FOS\UserBundle\Command\InstallAcesCommand::execute PHP Method

execute() protected method

See also: Command
protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface
$output Symfony\Component\Console\Output\OutputInterface
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (!$this->container->has('security.acl.provider')) {
            $output->writeln('You must setup the ACL system, see the Symfony2 documentation for how to do this.');
            return;
        }
        $provider = $this->container->get('security.acl.provider');
        $oid = new ObjectIdentity('class', $this->container->get('fos_user.user_manager')->getClass());
        try {
            $acl = $provider->createAcl($oid);
        } catch (AclAlreadyExistsException $exists) {
            $output->writeln('You already installed the global ACEs.');
            return;
        }
        // insert ACEs for the super admin
        $sid = new RoleSecurityIdentity(User::ROLE_SUPERADMIN);
        $acl->insertClassAce($sid, MaskBuilder::MASK_IDDQD);
        $provider->updateAcl($acl);
        $output->writeln('Global ACEs have been installed.');
    }
InstallAcesCommand