Permalink
Browse files

Fixes

  • Loading branch information...
1 parent c066061 commit b9d5e69aab0aa164ee6073db9a7e95b402c7be24 @cdujeu cdujeu committed Jun 9, 2016
@@ -69,8 +69,9 @@ public static function handleRequest(\Psr\Http\Message\ServerRequestInterface &$
} catch (NoActiveWorkspaceException $ex){
- $logged = AuthService::getLoggedUser();
- if($logged !== null) $lock = $logged->getLock();
+ /** @var ContextInterface $ctx */
+ $ctx = $requestInterface->getAttribute("ctx");
+ if($ctx->hasUser()) $lock = $ctx->getUser()->getLock();
if(empty($lock)){
throw new AuthRequiredException();
}
@@ -91,7 +92,9 @@ public static function handleRequest(\Psr\Http\Message\ServerRequestInterface &$
}catch(ActionNotFoundException $a){
- if(AuthService::getLoggedUser() == null){
+ /** @var ContextInterface $ctx */
+ $ctx = $requestInterface->getAttribute("ctx");
+ if(!$ctx->hasUser()){
throw new AuthRequiredException();
}else{
return new EmptyResponse();
@@ -61,7 +61,7 @@
use Zend\Diactoros\Response\JsonResponse;
defined('AJXP_EXEC') or die( 'Access not allowed');
-require_once("plugins/action.share/vendor/autoload.php");
+require_once(dirname(__FILE__)."/../vendor/autoload.php");
/**
* @package AjaXplorer_Plugins
@@ -165,7 +165,6 @@ public static function loadMinisite($data, $hash = '', $error = null)
}
if (isSet($_GET["lang"])) {
- $loggedUser = &AuthService::getLoggedUser();
if ($loggedUser != null) {
$loggedUser->setPref("lang", $_GET["lang"]);
} else {
@@ -115,7 +115,7 @@ public static function log2($level, $source, $prefix, $messages = array())
$ip = self::getClientAdress();
$user = self::getLoggedUser();
$logger = self::getInstance();
- $repoId = self::$context->hasRepository() ? self::$context->getRepositoryId() : "no-repository";
+ $repoId = (!empty(self::$context) && self::$context->hasRepository()) ? self::$context->getRepositoryId() : "no-repository";
if ($logger != null) {
try {
$logger->write2($level, $ip, $user, $repoId, $source, $prefix, $res, $nodePathes);
@@ -232,7 +232,7 @@ private function computeLocationType(){
$type = "workspace.normal";
$repo = $this->getNode()->getRepository();
$crtUserId = "shared";
- $crtUser = AuthService::getLoggedUser();
+ $crtUser = $this->getNode()->hasUser() ? $this->getNode()->getUser() : null;
if($crtUser != null) $crtUserId = $crtUser->getId();
if(isSet($_SESSION["CURRENT_MINISITE"])){
if($repo->hasContentFilter()){
@@ -35,6 +35,7 @@
use Pydio\Core\Controller\HTMLWriter;
use Pydio\Core\PluginFramework\Plugin;
use Pydio\Core\PluginFramework\PluginsService;
+use Zend\Diactoros\Response\JsonResponse;
defined('AJXP_EXEC') or die( 'Access not allowed');
@@ -75,8 +76,7 @@ public function getBootConf(ServerRequestInterface &$request, ResponseInterface
$out = array();
Utils::parseApplicationGetParameters($ctx, $request->getQueryParams(), $out, $_SESSION);
$config = $this->computeBootConf($ctx);
- $response = $response->withHeader("Content-type", "application/json;charset=UTF-8");
- $response->getBody()->write(json_encode($config));
+ $response = new JsonResponse($config);
}
/**
View
@@ -78,7 +78,7 @@ function applyTask($task, $logger){
//ConfService::switchRootDir($repo->getId());
}
$logger->debug("Init plugins");
- $newCtx = \Pydio\Core\Model\Context::contextWithObjects(AuthService::getLoggedUser(), $repo);
+ $newCtx = \Pydio\Core\Model\Context::contextWithObjects($user, $repo);
PluginsService::getInstance($newCtx);
$fakeRequest = \Zend\Diactoros\ServerRequestFactory::fromGlobals(array(), array(), $parameters)

0 comments on commit b9d5e69

Please sign in to comment.