Added DataAccess plugin, admin header completed

This commit is contained in:
franck
2013-07-25 22:59:46 +02:00
parent 0a89a21897
commit f7a635dbf7
31 changed files with 620 additions and 97 deletions

View File

@@ -37,6 +37,7 @@ use Thelia\Core\Security\SecurityContext;
use Thelia\Tools\URL;
use Thelia\Tools\Redirect;
use Thelia\Core\Template\ParserContext;
use Thelia\Core\Event\ActionEvent;
/**
*
@@ -133,10 +134,21 @@ class BaseAdminController extends ContainerAware
return $this->container->get('request');
}
/**
* Dispatch a Thelia event to modules
*
* @param string $eventName a TheliaEvent name, as defined in TheliaEvents class
* @param ActionEvent $event the event
*/
protected function dispatch($eventName, ActionEvent $event = null) {
$this->container->get("event_dispatcher")->dispatch($eventName, $event);
}
/**
* Returns the session from the current request
*
* @return Ambigous <NULL, \Symfony\Component\HttpFoundation\Session\SessionInterface>
* @return \Symfony\Component\HttpFoundation\Session\SessionInterface
*/
protected function getSession() {
@@ -146,8 +158,7 @@ class BaseAdminController extends ContainerAware
}
/**
*
* @return a ParserInterface instance parser, as configured.
* @return a ParserInterface instance parser
*/
protected function getParser()
{
@@ -159,16 +170,6 @@ class BaseAdminController extends ContainerAware
return $parser;
}
protected function getFormFactory()
{
return BaseForm::getFormFactory($this->getRequest(), ConfigQuery::read("form.secret.admin", md5(__DIR__)));
}
protected function getFormBuilder()
{
return $this->getFormFactory()->createBuilder("form");
}
/**
* Forwards the request to another controller.
*

View File

@@ -31,6 +31,7 @@ use Thelia\Core\Security\Exception\AuthenticationException;
use Symfony\Component\Validator\Exception\ValidatorException;
use Thelia\Tools\URL;
use Thelia\Tools\Redirect;
use Thelia\Core\Event\TheliaEvents;
class SessionController extends BaseAdminController {
@@ -41,6 +42,8 @@ class SessionController extends BaseAdminController {
public function checkLogoutAction()
{
$this->dispatch(TheliaEvents::ADMIN_LOGOUT);
$this->getSecurityContext()->clear();
// Go back to login page.
@@ -64,6 +67,8 @@ class SessionController extends BaseAdminController {
// Log authentication success
AdminLog::append("Authentication successuful", $request, $user);
$this->dispatch(TheliaEvents::ADMIN_LOGIN);
// Redirect to the success URL
return Redirect::exec($adminLoginForm->getSuccessUrl());
}