From 1c2acd6658feb4854b676ced3a18e8e50a390d3c Mon Sep 17 00:00:00 2001 From: cdujeu Date: Tue, 22 Nov 2016 09:29:45 +0100 Subject: [PATCH] Handle Minisite + Lock case - Fix #1278 --- .../action.share/src/Http/MinisiteAuthMiddleware.php | 9 ++++++--- .../plugins/action.share/src/View/MinisiteRenderer.php | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/src/plugins/action.share/src/Http/MinisiteAuthMiddleware.php b/core/src/plugins/action.share/src/Http/MinisiteAuthMiddleware.php index 623a7d645b..24da2c96ef 100644 --- a/core/src/plugins/action.share/src/Http/MinisiteAuthMiddleware.php +++ b/core/src/plugins/action.share/src/Http/MinisiteAuthMiddleware.php @@ -96,12 +96,15 @@ public static function handleRequest(ServerRequestInterface $requestInterface, R ApplicationState::setStateMinisite($hash); } if(!empty($ctx) && $ctx->hasUser() && isSet($shareData["REPOSITORY"])){ - $repoObject = UsersService::getRepositoryWithPermission($ctx->getUser(), $shareData["REPOSITORY"]); - $ctx->setRepositoryObject($repoObject); if($sessions){ SessionService::saveRepositoryId($shareData["REPOSITORY"]); } - $requestInterface = $requestInterface->withAttribute("ctx", $ctx); + $uLock = $ctx->getUser()->getLock(); + if(empty($uLock)){ + $repoObject = UsersService::getRepositoryWithPermission($ctx->getUser(), $shareData["REPOSITORY"]); + $ctx->setRepositoryObject($repoObject); + $requestInterface = $requestInterface->withAttribute("ctx", $ctx); + } } return Server::callNextMiddleWare($requestInterface, $responseInterface, $next); diff --git a/core/src/plugins/action.share/src/View/MinisiteRenderer.php b/core/src/plugins/action.share/src/View/MinisiteRenderer.php index fd4ab5b588..3254ae5278 100644 --- a/core/src/plugins/action.share/src/View/MinisiteRenderer.php +++ b/core/src/plugins/action.share/src/View/MinisiteRenderer.php @@ -178,7 +178,7 @@ public static function writeHtml(ResponseInterface $responseInterface, ContextIn $confs = $shareCenter->getConfigs(); } $repoObject = $context->getRepository(); - if($repoObject === null && isSet($data['PRESET_LOGIN']) && isSet($data["REPOSITORY"])){ + if($repoObject === null && (isSet($data['PRESET_LOGIN']) || ($context->hasUser() && $context->getUser()->getLock() !== false)) && isSet($data["REPOSITORY"])){ $repoObject = RepositoryService::getRepositoryById($data["REPOSITORY"]); }