The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ

Made registration management working

Signed-off-by: Gergely Polonkai <polesz@w00d5t0ck.info>
master
Polonkai Gergely 10 years ago
parent 41c85703b3
commit e24145dfe7
  1. 2
      app/config/config.yml
  2. 19
      src/KekRozsak/AdminBundle/Controller/DefaultController.php
  3. 1
      src/KekRozsak/AdminBundle/Resources/views/Default/manageRegs.html.twig

@ -65,4 +65,4 @@ swiftmailer:
password: %mailer_password%
spool:
type: file
path: %kernel.root_dir%/spool
path: %kernel.root_dir%/../spool

@ -5,6 +5,7 @@ namespace KekRozsak\AdminBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
/**
* @Route("/admin")
@ -17,7 +18,25 @@ class DefaultController extends Controller
*/
public function manageRegsAction()
{
if (!$this->get('security.context')->isGranted('ROLE_ADMIN')) {
throw new AccessDeniedException('Ehhez a művelethez nincs jogosultságod.');
}
$users = $this->getDoctrine()->getEntityManager()->createQuery('SELECT u FROM KekRozsakSecurityBundle:User u WHERE u.acceptedBy IS NULL')->getResult();
$request = $this->getRequest();
if ($request->getMethod() == 'POST') {
if (is_numeric($userid = $request->get('userid'))) {
if (($user = $this->getDoctrine()->getRepository('KekRozsakSecurityBundle:User')->findOneById($userid)) != null) {
$activeUser = $this->get('security.context')->getToken()->getUser();
$user->setAcceptedBy($activeUser);
$em = $this->getDoctrine()->getEntityManager();
$em->persist($user);
$em->flush();
return $this->redirect($this->generateUrl('KekRozsakAdminBundle_manage_regs'));
}
}
}
return array(
'users' => $users,

@ -23,6 +23,7 @@
<td>{{ user.registeredAt|date('Y-m-d H:i') }}</td>
<td>
<form method="post" action="">
<input type="hidden" name="userid" value="{{ user.id }}" />
<button type="submit">Engedélyezem</button>
</form>
</td>

Loading…
Cancel
Save