Ejemplo n.º 1
0
 public function transOrganization($ldapObject)
 {
     $organization = new Organization();
     $organization->setCn($ldapObject->getCn());
     $organization->setZacaciastatus($ldapObject->getZacaciastatus());
     $organization->setZarafaHidden($ldapObject->getZarafaHidden());
     $organization->setZarafaAccount($ldapObject->getZarafaAccount());
     return $organization;
 }
Ejemplo n.º 2
0
 /**
  * @Route("/customer/{platformid}/new", name="_organization_new", requirements={
  *     "platformid": "([a-z0-9]{8})(\-[a-z0-9]{4}){3}(\-[a-z0-9]{12})"
  * })
  */
 public function newAction(Request $request, $platformid)
 {
     $platform_repository = (new PlatformPeer())->getLdapManager()->getRepository('platform');
     $platform = $platform_repository->getPlatformByUUID($platformid);
     $organization = new Organization();
     $organization->setZacaciastatus("enable");
     $organization->setZarafahidden("0");
     $organization->setPlatform($platform->getEntryUUID());
     $form = $this->createForm(OrganizationType::class, $organization);
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         try {
             $organizationPeer = new OrganizationPeer($platform->getDn());
             $organizationPeer->createOrganization($organization);
             return $this->redirectToRoute('_organization', array('platformid' => $platform->getEntryUUID()));
         } catch (LdapConnectionException $e) {
             echo "Failed to add server!" . PHP_EOL;
             echo $e->getMessage() . PHP_EOL;
         }
     }
     return $this->render('ZacaciaBundle:Organization:new.html.twig', array('platform' => $platform, 'form' => $form->createView()));
 }