Permalink
Browse files

Fix deconnexion on empty action.

  • Loading branch information...
1 parent b737e68 commit 69df96451a7ae3d4e55899dbfb558e8bd2521388 @cdujeu cdujeu committed May 26, 2016
@@ -189,7 +189,7 @@ public static function run(ServerRequestInterface $request, &$actionNode = null)
if ($actionNode == null) {
$actions = $xPath->query("actions/action[@name='$actionName']");
if (!$actions->length) {
- throw new AuthRequiredException($actionName);
+ throw new ActionNotFoundException($actionName);
}
$actionNode = $actions->item(0);
}
@@ -21,17 +21,15 @@
namespace Pydio\Core\Http\Middleware;
use Psr\Http\Message\ServerRequestInterface;
-use Pydio\Authfront\Core\AbstractAuthFrontend;
use Pydio\Authfront\Core\FrontendsLoader;
+use Pydio\Core\Exception\ActionNotFoundException;
use Pydio\Core\Exception\AuthRequiredException;
use Pydio\Core\Exception\NoActiveWorkspaceException;
use Pydio\Core\Exception\PydioException;
-use Pydio\Core\Exception\WorkspaceNotFoundException;
use Pydio\Core\Http\Server;
-use Pydio\Core\PluginFramework\PluginsService;
use Pydio\Core\Services\AuthService;
use Pydio\Core\Services\ConfService;
-use Pydio\Log\Core\AJXP_Logger;
+use Zend\Diactoros\Response\EmptyResponse;
defined('AJXP_EXEC') or die('Access not allowed');
@@ -69,7 +67,18 @@ public static function handleRequest(\Psr\Http\Message\ServerRequestInterface &$
}
- return Server::callNextMiddleWare($requestInterface, $responseInterface, $next);
+ try{
+
+ return Server::callNextMiddleWare($requestInterface, $responseInterface, $next);
+
+ }catch(ActionNotFoundException $a){
+
+ if(AuthService::getLoggedUser() == null){
+ throw new AuthRequiredException();
+ }else{
+ return new EmptyResponse();
+ }
+ }
}

0 comments on commit 69df964

Please sign in to comment.