Files
Phraseanet/lib/Alchemy/Phrasea/Security/Firewall.php
Nicolas Le Goff 367cf7c2a4 add /login/authenticate/
remove  login/authenticate controller

add generateEmail function

move parent::tearDownAfterClass at the end od the function

use twitter bootstrap alert component

Update doc blocks & fix issues

add XMLHTTPRequest to PhraseanetPHPUNIt framework

fix tests

remove var_dump

refactor postlog process

fix URI's

fix redirection URI
2012-08-21 17:32:00 +02:00

38 lines
803 B
PHP

<?php
namespace Alchemy\Phrasea\Security;
use Silex\Application;
class Firewall
{
public function requireSetUp(Application $app)
{
if ( ! \setup::is_installed()) {
return $app->redirect("/setup/");
}
}
public function requireAuthentication(Application $app)
{
if (false === $app['phraseanet.core']->isAuthenticated()) {
return $app->redirect('/login/');
}
if ($app['phraseanet.core']->getAuthenticatedUser()->is_guest()) {
return $app->redirect('/login/');
}
try {
$session = $app['phraseanet.appbox']->get_session();
$session->open_phrasea_session();
} catch (\Exception $e) {
return $app->redirect('/login/logout/');
}
}
}