Пример #1
0
 /**
  * @Route("/customer/{platformid}/{organizationid}/edit", name="_organization_edit", requirements={
  *     "platformid": "([a-z0-9]{8})(\-[a-z0-9]{4}){3}(\-[a-z0-9]{12})",
  *     "organizationid": "([a-z0-9]{8})(\-[a-z0-9]{4}){3}(\-[a-z0-9]{12})"
  * })
  */
 public function editAction(Request $request, $platformid, $organizationid)
 {
     $platform_repository = (new PlatformPeer())->getLdapManager()->getRepository('platform');
     $platform = $platform_repository->getPlatformByUUID($platformid);
     $organizationPeer = new OrganizationPeer($platform->getDn());
     $organization_repository = $organizationPeer->getLdapManager()->getRepository('organization');
     $organizationLdap = $organization_repository->getOrganizationByUUID($organizationid);
     $tranformer = new ZacaciaTransformer();
     $organization = $tranformer->transOrganization($organizationLdap);
     $form = $this->createForm(OrganizationType::class, $organization);
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         try {
             $organizationLdap->setZarafaHidden($organization->getZarafaHidden());
             $organizationLdap->setZarafaAccount($organization->getZarafaAccount());
             $organizationLdap->setZacaciastatus($organization->getZacaciastatus());
             $organizationPeer->updateOrganization($organizationLdap);
             return $this->redirectToRoute('_organization', array('platformid' => $platform->getEntryUUID()));
         } catch (LdapConnectionException $e) {
             echo "Failed to update organization!" . PHP_EOL;
             echo $e->getMessage() . PHP_EOL;
         }
     }
     return $this->render('ZacaciaBundle:Organization:edit.html.twig', array('platform' => $platform, 'organization' => $organization, 'form' => $form->createView()));
 }
Пример #2
0
 /**
  * @Route("/platform/{platformid}/edit", name="_platform_edit", requirements={
  *     "platformid": "([a-z0-9]{8})(\-[a-z0-9]{4}){3}(\-[a-z0-9]{12})"
  * })
  */
 public function editAction(Request $request, $platformid)
 {
     $platformPeer = new PlatformPeer();
     $platformLdap = $platformPeer->getLdapManager()->getRepository('platform')->getPlatformByUUID($platformid);
     $tranformer = new ZacaciaTransformer();
     $platform = $tranformer->transPlatform($platformLdap);
     $form = $this->createForm(PlatformType::class, $platform);
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         try {
             $platformLdap->setZacaciastatus($platform->getZacaciastatus());
             $platformPeer->updatePlaform($platformLdap);
             return $this->redirectToRoute('_platform');
         } catch (LdapConnectionException $e) {
             echo "Failed to update Platform!" . PHP_EOL;
             echo $e->getMessage() . PHP_EOL;
         }
     }
     return $this->render('ZacaciaBundle:Platform:edit.html.twig', array('platform' => $platform, 'form' => $form->createView()));
 }
Пример #3
0
 /**
  * @Route("/server/{platformid}/{serverid}/edit", name="_server_edit", requirements={
  *     "platformid": "([a-z0-9]{8})(\-[a-z0-9]{4}){3}(\-[a-z0-9]{12})",
  *     "serverid": "([a-z0-9]{8})(\-[a-z0-9]{4}){3}(\-[a-z0-9]{12})"
  * })
  */
 public function editAction(Request $request, $platformid, $serverid)
 {
     $platform_repository = (new PlatformPeer())->getLdapManager()->getRepository('platform');
     $platform = $platform_repository->getPlatformByUUID($platformid);
     $serverPeer = new ServerPeer($platform->getDn());
     $server_repository = $serverPeer->getLdapManager()->getRepository('server');
     $serverLdap = $server_repository->getServerByUUID($serverid);
     $tranformer = new ZacaciaTransformer();
     $server = $tranformer->transServer($serverLdap);
     $form = $this->createForm(ServerType::class, $server);
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         try {
             $serverLdap->setZacaciastatus($server->getZacaciastatus());
             $serverPeer->updateServer($serverLdap);
             return $this->redirectToRoute('_server', array('platformid' => $platform->getEntryUUID()));
         } catch (LdapConnectionException $e) {
             echo "Failed to update server!" . PHP_EOL;
             echo $e->getMessage() . PHP_EOL;
         }
     }
     return $this->render('ZacaciaBundle:Server:edit.html.twig', array('platform' => $platform, 'server' => $server, 'form' => $form->createView()));
 }
Пример #4
0
 /**
  * @Route("/user/{platformid}/{organizationid}/{userid}/password", name="_user_password", requirements={
  *     "platformid": "([a-z0-9]{8})(\-[a-z0-9]{4}){3}(\-[a-z0-9]{12})",
  *     "organizationid": "([a-z0-9]{8})(\-[a-z0-9]{4}){3}(\-[a-z0-9]{12})",
  *     "userid": "([a-z0-9]{8})(\-[a-z0-9]{4}){3}(\-[a-z0-9]{12})"
  * })
  */
 public function passwordAction(Request $request, $platformid, $organizationid, $userid)
 {
     $platform_repository = (new PlatformPeer())->getLdapManager()->getRepository('platform');
     $platform = $platform_repository->getPlatformByUUID($platformid);
     $organizationPeer = new OrganizationPeer($platform->getDn());
     $organization_repository = $organizationPeer->getLdapManager()->getRepository('organization');
     $organization = $organization_repository->getOrganizationByUUID($organizationid);
     $userPeer = new UserPeer($organization->getDn());
     $user_repository = $userPeer->getLdapManager()->getRepository('user');
     $userLdap = $user_repository->getUserByUUID($userid);
     $domainPeer = new DomainPeer($organization->getDn());
     $domain_repository = $domainPeer->getLdapManager()->getRepository('domain');
     $tranformer = new ZacaciaTransformer();
     $user = $tranformer->transUser($userLdap, $platform, $organization);
     # print_r( $user ); exit;
     $form = $this->createForm(ChangePwdType::class, $user);
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         try {
             $userLdap->setuserPassword($user->getPassword());
             $userPeer->updateUser($userLdap);
             return $this->redirectToRoute('_user', array('platformid' => $platform->getEntryUUID(), 'organizationid' => $organization->getEntryUUID()));
         } catch (LdapConnectionException $e) {
             echo "Failed to update user!" . PHP_EOL;
             echo $e->getMessage() . PHP_EOL;
         }
     }
     return $this->render('ZacaciaBundle:User:password.html.twig', array('platform' => $platform, 'organization' => $organization, 'user' => $user, 'form' => $form->createView()));
 }