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

Commit

Permalink
Make sure to use === when comparing to constants, or repo 0 can be co…
Browse files Browse the repository at this point in the history
…nsidered as repo_scope_all. Enable kvcaching in non-rest controller.
  • Loading branch information
cdujeu committed Jan 5, 2016
1 parent 55c1efc commit 07775c1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/src/core/classes/class.AJXP_Controller.php
Expand Up @@ -161,7 +161,7 @@ public static function findActionAndApply($actionName, $httpVars, $fileVars, &$a
self::$lastActionNeedsAuth = true;
return null;
}
$xPath = self::initXPath();
$xPath = self::initXPath(true);
if ($action == null) {
$actions = $xPath->query("actions/action[@name='$actionName']");
if (!$actions->length) {
Expand Down Expand Up @@ -471,7 +471,7 @@ public static function applyHook($hookName, $args, $forceNonDefer = false)
}
return;
}
$xPath = self::initXPath();
$xPath = self::initXPath(true);
$callbacks = $xPath->query("hooks/serverCallback[@hookName='$hookName']");
if(!$callbacks->length) return ;
self::$hooksCache[$hookName] = array();
Expand Down
10 changes: 7 additions & 3 deletions core/src/core/classes/class.ConfService.php
Expand Up @@ -328,8 +328,12 @@ private static function getRegistryCacheKey($extendedVersion = true){

$logged = AuthService::getLoggedUser();
$u = $logged == null ? "shared" : $logged->getId();
$r = ConfService::getRepository();
$a = $r->getSlug();
if($logged !== null){
$r = ConfService::getRepository();
$a = $r->getSlug();
}else{
$a = "norepository";
}
$v = $extendedVersion ? "extended":"light";
return "xml_registry:".$v.":".$u.":".$a;

Expand Down Expand Up @@ -368,7 +372,7 @@ public static function filterRegistryFromRole(&$registry)
}
$parameters = $loggedUser->mergedRole->listParameters();
foreach ($parameters as $scope => $paramsPlugs) {
if ($scope == AJXP_REPO_SCOPE_ALL || $scope == $crtRepoId || ($crtRepo!=null && $crtRepo->hasParent() && $scope == AJXP_REPO_SCOPE_SHARED)) {
if ($scope === AJXP_REPO_SCOPE_ALL || $scope === $crtRepoId || ($crtRepo!=null && $crtRepo->hasParent() && $scope === AJXP_REPO_SCOPE_SHARED)) {
foreach ($paramsPlugs as $plugId => $params) {
foreach ($params as $name => $value) {
// Search exposed plugin_configs, replace if necessary.
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/core.mq/class.MqManager.php
Expand Up @@ -130,7 +130,7 @@ public function publishNodeChange($origNode = null, $newNode = null, $copy = fal

public function sendInstantMessage($xmlContent, $repositoryId, $targetUserId = null, $targetGroupPath = null, $nodePathes = array())
{
if ($repositoryId == AJXP_REPO_SCOPE_ALL) {
if ($repositoryId === AJXP_REPO_SCOPE_ALL) {
$userId = $targetUserId;
} else {
$scope = ConfService::getRepositoryById($repositoryId)->securityScope();
Expand Down

0 comments on commit 07775c1

Please sign in to comment.