Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit 4a2830f

Browse files
committed
Encapsulate <reload_repository> in a dedicated message object.
1 parent 2d67e8c commit 4a2830f

File tree

4 files changed

+62
-13
lines changed

4 files changed

+62
-13
lines changed

core/src/core/src/pydio/Core/Controller/XMLWriter.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -321,16 +321,6 @@ public static function reloadDataNode($nodePath="", $pendingSelection="", $print
321321
return XMLWriter::write("<reload_instruction object=\"data\" node=\"$nodePath\" file=\"$pendingSelection\"/>", $print);
322322
}
323323

324-
/**
325-
* Send a <reload> XML instruction for refreshing the repositories list
326-
* @static
327-
* @param bool $print
328-
* @return string
329-
*/
330-
public static function reloadRepositoryList($print = true)
331-
{
332-
return XMLWriter::write("<reload_instruction object=\"repository_list\"/>", $print);
333-
}
334324
/**
335325
* Outputs a <require_auth/> tag
336326
* @static
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
/*
3+
* Copyright 2007-2016 Abstrium <contact (at) pydio.com>
4+
* This file is part of Pydio.
5+
*
6+
* Pydio is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU Affero General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* (at your option) any later version.
10+
*
11+
* Pydio is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU Affero General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Affero General Public License
17+
* along with Pydio. If not, see <http://www.gnu.org/licenses/>.
18+
*
19+
* The latest code can be found at <https://pydio.com/>.
20+
*/
21+
namespace Pydio\Core\Http\Message;
22+
23+
use Pydio\Core\Http\Response\XMLSerializableResponseChunk;
24+
25+
defined('AJXP_EXEC') or die('Access not allowed');
26+
27+
/**
28+
* Class ReloadRepoListMessage Encapsulate XML message for reloading repositories list
29+
* @package Pydio\Core\Http\Message
30+
*/
31+
class ReloadRepoListMessage extends Message implements XMLSerializableResponseChunk
32+
{
33+
/**
34+
* ReloadRepoListMessage constructor.
35+
*/
36+
public function __construct()
37+
{
38+
parent::__construct("reload_repositories");
39+
}
40+
41+
/**
42+
* Serialize as XML
43+
* @return string
44+
*/
45+
public function toXML()
46+
{
47+
return "<reload_instruction object=\"repository_list\"/>";
48+
}
49+
50+
public static function XML(){
51+
$m = new ReloadRepoListMessage();
52+
return $m->toXML();
53+
}
54+
55+
}

core/src/plugins/access.ajxp_conf/src/RolesManager.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,12 @@ public function rolesActions(ServerRequestInterface $requestInterface, ResponseI
297297
$scope = "role";
298298
if($roleGroup) {
299299
$scope = "group";
300-
if($roleId == "AJXP_GRP_/") $scope = "role";
300+
if($roleId == "AJXP_GRP_/") {
301+
$scope = "role";
302+
}
303+
}else if(isSet($userObject)) {
304+
$scope = "user";
301305
}
302-
else if(isSet($userObject)) $scope = "user";
303306
$data["SCOPE_PARAMS"] = array();
304307
$nodes = PluginsService::getInstance($ctx)->searchAllManifests("//param[contains(@scope,'".$scope."')]|//global_param[contains(@scope,'".$scope."')]", "node", false, true, true);
305308
foreach ($nodes as $node) {

core/src/plugins/authfront.session_login/SessionLoginFrontend.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
namespace Pydio\Auth\Frontend;
2222

2323
use Exception;
24+
use Pydio\Core\Http\Message\ReloadRepoListMessage;
2425
use Pydio\Core\Model\Context;
2526
use Pydio\Core\Model\UserInterface;
2627
use Pydio\Core\Services\AuthService;
@@ -72,7 +73,7 @@ protected function logUserFromSession(\Psr\Http\Message\ServerRequestInterface &
7273

7374
if ($u->reloadRolesIfRequired()) {
7475
ConfService::getInstance()->invalidateLoadedRepositories();
75-
AuthService::$bufferedMessage = XMLWriter::reloadRepositoryList(false);
76+
AuthService::$bufferedMessage = ReloadRepoListMessage::XML();
7677
}
7778
$request = $request->withAttribute("ctx", Context::contextWithObjects($u, null));
7879
return true;

0 commit comments

Comments
 (0)