/** * @Route("/domain/{platformid}/{organizationid}/{domainid}/delete", name="_domain_delete", 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})", * "domainid": "([a-z0-9]{8})(\-[a-z0-9]{4}){3}(\-[a-z0-9]{12})" * }) */ public function deleteAction(Request $request, $platformid, $organizationid, $domainid) { $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); try { $domainPeer = new DomainPeer($organization->getDn()); $domainPeer->deleteDomain($domainid, true); } catch (LdapConnectionException $e) { echo "Failed to delete domain!" . PHP_EOL; echo $e->getMessage() . PHP_EOL; } return $this->redirectToRoute('_domain', array('platformid' => $platform->getEntryUUID(), 'organizationid' => $organization->getEntryUUID())); }
/** * @Route("/check/groupname/{platformid}/{organizationid}/{name}", name="_check_groupname", 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})", * "name": ".+" * }) * @Method({"GET","HEAD"}) */ public function checkgroupnameAction(Request $request, $platformid, $organizationid, $name) { $platformPeer = new PlatformPeer(); $platform_repository = $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); $base_dn = sprintf('ou=Groups,%s', $organization->getDn()); $groupPeer = new GroupPeer($base_dn); $groups = $groupPeer->getLdapManager()->getRepository('group')->getGroupByName($name); $response = new JsonResponse(); $response->setData(array('data' => count($groups))); return $response; }