Файл: Проектирование информационной системы по управлению.pdf

ВУЗ: Не указан

Категория: Курсовая работа

Дисциплина: Не указана

Добавлен: 16.02.2024

Просмотров: 38

Скачиваний: 0

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

return $this->redirectToRoute('site_users_index');

}

}

$this->forms['user'] = $form->createView();

$this->view['user'] = $user;

$this->navigation = array('active' => 'users');

return $this->render('AppBundle:Users:edit.html.twig');

}

}

/**

* @param User $user

* @return Response

* @Config\Route("/users/{user}/remove", name = "site_users_remove")

* @Config\ParamConverter("user", options = {"mapping": {"user": "id"}})

*/

public function removeAction(User $user)

{

$user->setDeleted(true);

$this->manager->persist($user);

$this->manager->flush();

return $this->redirectToRoute('site_users_index');

}

}

<?php namespace AppBundle\Controller;

use AppBundle\Form\Type\LoginFormType;

use AppBundle\Form\Type\ProfileFormType;

use AppBundle\Controller\InitializableController;

use AppBundle\Entity\Role; use AppBundle\Entity\User;

use Sensio\Bundle\FrameworkExtraBundle\Configuration as Config;

use Symfony\Component\Form\FormError;

use Symfony\Component\HttpFoundation\RedirectResponse;

use Symfony\Component\HttpFoundation\Response;

use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;

use Symfony\Component\Security\Core\Encoder\UserPasswordEncoder;

use Symfony\Component\Security\Core\Security; class SecurityController extends InitializableController {

/**

* @return RedirectResponse|Response

* @Config\Route("/login", name = "site_security_login")

*/

public function loginAction()

{

if ($this->authChecker->isGranted(Role::USER)) return $this>redirectToRoute('homepage');

$error = null;

if ($this->request->attributes >has(Security::AUTHENTICATION_ERROR))

$error = $this->request->attributes>get(Security::AUTHENTICATION_ERROR);

else {

$error = $this->session->get(Security::AUTHENTICATION_ERROR, null);

$this->session->remove(Security::AUTHENTICATION_ERROR);

}

if (!is_null($error)) {

$this->addNotice('error', 'security_login.html.twig', array('notice' => 'auth_error'));

}

$form = $this->createForm(new LoginFormType(), new User());

$this->navigation = array('active' => 'login');

$this->forms = array(

'login' => $form->createView(),

'last_username' => $this->session->get(Security::LAST_USERNAME, null)

);

return $this->render('AppBundle:Security:login.html.twig');

}

/**

* @throws NotFoundHttpException

* @Config\Route("/login-check", name = "site_security_login_check")

*/

public function loginCheckAction()

{

throw $this->createNotFoundException();

}

/**

* @throws NotFoundHttpException

* @Config\Route("/logout", name = "site_security_logout")

*/

public function logoutAction()

{

throw $this->createNotFoundException();

}

/**

* @return RedirectResponse|Response

* @Config\Route("/profile", name = "site_security_profile")

*/

public function profileAction()

{

$form = $this->createForm(new ProfileFormType(), $this->user); $form->handleRequest($this->request);

if ($form->isSubmitted() && $form->isValid()) {

if (!is_null($form->get('password')->getData())) {

/** @var UserPasswordEncoder $encoder */

$encoder = $this->get('security.password_encoder');

$this->user->setSalt(User::generateSalt()) ->setPassword($encoder->encodePassword($this->user, $this->user>getPassword()));

$this->manager->persist($this->user);

$this->manager->flush();

}

$this->addNotice('success',

'security_profile.html.twig',

array('notice' => 'user_changed')

);

return $this->redirectToRoute('homepage');

} $this->forms['profile'] = $form->createView();

$this->navigation = array('active' => 'homepage');

return $this->render('AppBundle:Security:profile.html.twig');

}

}

  1. https://www.list-org.com/company/4577575

  2. Аглицкий И. Автоматизация управления предприятием, 2016. – 310с. (3).

  3. Автоматизированные информационные технологии в экономике / Под ред. Г.А. Титоренко. – М.:ЮНИТИ, 2017. – 125с. (1).

  4. Бородакий Ю. В., Лободинский Ю. Г. Информационные технологии: Методы, процессы, системы / Ю.В. Борода¬кий, Ю.Г. Лободинский. – М.: Радио и связь, 2014. – 371 с.

  5. Современные методы и средства проектирования информационных систем, Вендров А.М., 2017. – 400с. 15).