mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-14 13:33:14 +00:00

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
38 lines
803 B
PHP
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/');
|
|
}
|
|
}
|
|
}
|