/**
  * Get service.
  *
  * @return VhostBuilderService
  */
 public function serviceProvider()
 {
     $service = $this->getVhostBuilderService();
     $certificate = new Certificate();
     $user = new User();
     $defaultIpSsl = new IpAddress();
     $defaultIp = new IpAddress();
     $certificate->setName('normal')->setCertificateFile('asd')->setCertificateKeyFile('dodooodood');
     $user->setName('jeff')->setGroupname('jeff')->setUid(1000)->setGid(1000);
     $defaultIp->setAlias('default, no ssl')->setHasSsl(false)->setIp('127.0.0.1')->setPort(80);
     $defaultIpSsl->setAlias('default, ssl')->setHasSsl(true)->setIp('127.0.0.1')->setPort(443);
     $domain1 = new Domain();
     $domain2 = new Domain();
     $domain3 = new Domain();
     $domain1->setDomain('lampcp1.de')->setPath('/var/www/lampcp1.de')->setParsePhp(true)->setUser($user)->setWebroot('htdocs')->setCertificate($certificate);
     $domain2->setDomain('lampcp2.de')->setPath('/var/www/lampcp2.de')->setParsePhp(true)->setUser($user)->setWebroot('htdocs');
     $domain3->setDomain('lampcp3.de')->setPath('/var/www/lampcp3.de')->setParsePhp(false)->setUser($user)->setWebroot('htdocs')->setCertificate($certificate);
     $domain1->getIpaddress()->add($defaultIp);
     $domain2->getIpaddress()->add($defaultIpSsl);
     $domain2->getIpaddress()->add($defaultIp);
     $domain3->getIpaddress()->add($defaultIpSsl);
     $subdomain1 = new Subdomain($domain1);
     $subdomain2 = new Subdomain($domain2);
     $subdomain1->setSubdomain('nopaste');
     $subdomain2->setSubdomain('wiki');
     $domain1->getSubdomain()->add($subdomain1);
     $domain2->getSubdomain()->add($subdomain2);
     $service->setDomains(array($domain1, $domain2, $domain3));
     return array(array($service));
 }
Beispiel #2
0
 /**
  * Set up.
  */
 public function setUp()
 {
     /** @var $twig TwigEngine */
     $twig = $this->createClient()->getContainer()->get('templating');
     $user = new User();
     $user->setGid(1000)->setUid(1000)->setGroupname('test')->setName('test');
     $this->creator = new PoolCreator($twig, sys_get_temp_dir(), $user);
 }
 /**
  * Get domain.
  *
  * @return Domain
  */
 protected function _getDomain()
 {
     $user = new User();
     $domain = new Domain();
     $user->setName('www-data')->setUid(1000)->setGid(1000)->setGroupname('www-data');
     $domain->setUser($user)->setPath($this->_getTestPath());
     return $domain;
 }
Beispiel #4
0
 /**
  * Test getSuexecUserGroup().
  */
 public function testGetSuexecUserGroup()
 {
     $user = new User();
     $user->setName('jeff')->setGroupname('staff');
     $domain = new Domain();
     $domain->setUser($user);
     $vhost = new Vhost();
     $vhost->setDomain($domain);
     $this->assertEquals('jeff staff', $vhost->getSuexecUserGroup());
 }
 /**
  * Get test user.
  *
  * @return User
  */
 protected function _getUser()
 {
     $user = new User();
     $user->setName('testneverexists')->setGid(1000)->setUid(1000)->setGroupname('test');
     return $user;
 }
Beispiel #6
0
 /**
  * Render and return the pool configuration.
  *
  * @return string
  */
 public function getPoolConfiguration()
 {
     $vars = array('poolname' => $this->getPoolName(), 'user' => $this->_user->getName(), 'group' => $this->_user->getGroupname(), 'socket' => $this->getSocketPath());
     $file = $this->_twig->render(self::CFG_POOL_TEMPLATE, $vars);
     return $file;
 }
Beispiel #7
0
 /**
  * Copy system users to local storage.
  */
 public function copyToLocal()
 {
     foreach ($this->_passwdservice->getAll() as $systemuser) {
         /** @var User $localuser */
         $localuser = $this->getUserRepository()->findOneBy(array('name' => $systemuser->getName()));
         if (!$localuser) {
             /** @var Group $group */
             $group = $this->_groupservice->findOneBy(array('gid' => $systemuser->getGid()));
             $localuser = new User();
             $localuser->setName($systemuser->getName())->setUid($systemuser->getUid())->setGid($systemuser->getGid())->setGroupname($group->getName());
             $this->persistUser($localuser);
         } else {
             $changed = false;
             if ($localuser->getUid() !== $systemuser->getUid()) {
                 $localuser->setUid($systemuser->getUid());
                 $changed = true;
             }
             if ($localuser->getGid() !== $systemuser->getGid()) {
                 /** @var Group $group */
                 $group = $this->_groupservice->findOneBy(array('gid' => $systemuser->getGid()));
                 $changed = true;
                 $localuser->setGid($systemuser->getGid())->setGroupname($group->getName());
             }
             if ($changed) {
                 $this->persistUser($localuser);
             }
         }
     }
 }