Permalink
Browse files

Fix NoActiveRepository case

  • Loading branch information...
1 parent 83de4c5 commit 45e13a7967ee4123b662d26e94bdb1776b0f118c @cdujeu cdujeu committed Jun 23, 2016
@@ -35,6 +35,7 @@
use Pydio\Core\Services\ConfService;
+use Pydio\Log\Core\Logger;
use Zend\Diactoros\Response\EmptyResponse;
defined('AJXP_EXEC') or die('Access not allowed');
@@ -66,12 +67,7 @@ public static function handleRequest(\Psr\Http\Message\ServerRequestInterface &$
} catch (NoActiveWorkspaceException $ex){
- /** @var ContextInterface $ctx */
- $ctx = $requestInterface->getAttribute("ctx");
- if($ctx->hasUser()) $lock = $ctx->getUser()->getLock();
- if(empty($lock)){
- throw new AuthRequiredException();
- }
+ throw new AuthRequiredException();
} catch(ActionNotFoundException $a){
@@ -83,9 +79,7 @@ public static function handleRequest(\Psr\Http\Message\ServerRequestInterface &$
return new EmptyResponse();
}
}
-
- return $responseInterface;
-
+
}
}
@@ -71,6 +71,15 @@ public static function handleRequest(ServerRequestInterface &$requestInterface,
}
throw $r;
+ } catch (NoActiveWorkspaceException $nA) {
+
+ $lock = $loggedUser->getLock();
+ if(!empty($lock)){
+ return Server::callNextMiddleWare($requestInterface, $responseInterface, $next);
+ }else{
+ throw $nA;
+ }
+
}
}
@@ -129,7 +129,7 @@ public static function getRepositoryWithPermission($user, $repositoryId){
throw new WorkspaceNotFoundException($repositoryId);
}
if(!RepositoryService::repositoryIsAccessible($repo, $user)){
- return new WorkspaceForbiddenException($repositoryId);
+ throw new WorkspaceForbiddenException($repositoryId);
}
return $repo;
}
@@ -77,7 +77,7 @@ public function route(ServerRequestInterface &$request, ResponseInterface &$resp
$taskService = TaskService::getInstance();
/** @var ContextInterface $ctx */
$ctx = $request->getAttribute("ctx");
- if(!$ctx->hasUser()){
+ if(!$ctx->hasUser() || !$ctx->hasRepository()){
return;
}
switch ($action){

0 comments on commit 45e13a7

Please sign in to comment.