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

Commit

Permalink
ConfService: add some includeHooks to contribute with repositories.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Feb 25, 2016
1 parent 793127c commit bcefb89
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions core/src/core/classes/class.ConfService.php
Expand Up @@ -565,9 +565,12 @@ public static function getRepositoriesList($scope = "user", $includeShared = tru
*/
private function getLoadedRepositories()
{
if (isSet($_SESSION["REPOSITORIES"]) && is_array($_SESSION["REPOSITORIES"])){
$this->configs["REPOSITORIES"] = $_SESSION["REPOSITORIES"];
return $_SESSION["REPOSITORIES"];
if (!isSet($this->configs["REPOSITORIES"]) && isSet($_SESSION["REPOSITORIES"]) && is_array($_SESSION["REPOSITORIES"])){
$sessionNotCorrupted = array_reduce($_SESSION["REPOSITORIES"], function($carry, $item){ return $carry && is_a($item, "Repository"); }, true);
if($sessionNotCorrupted){
$this->configs["REPOSITORIES"] = $_SESSION["REPOSITORIES"];
return $_SESSION["REPOSITORIES"];
}
}
if (isSet($this->configs["REPOSITORIES"])) {
return $this->configs["REPOSITORIES"];
Expand Down Expand Up @@ -687,7 +690,7 @@ public static function repositoryIsAccessible($repositoryId, $repositoryObject,
}
$res = null;
$args = array($repositoryId, $repositoryObject, $userObject, &$res);
AJXP_Controller::applyIncludeHook("sec.access_ws", $args);
AJXP_Controller::applyIncludeHook("repository.test_access", $args);
if($res === false){
return false;
}
Expand Down Expand Up @@ -889,8 +892,8 @@ protected function initRepositoriesListInst($scope = "user", $includeShared = tr
$objList[$key] = $value;
}
}
$args = array(&$objList);
AJXP_Controller::applyIncludeHook("sec.access_ws", $args);
$args = array(&$objList, $scope, $includeShared);
AJXP_Controller::applyIncludeHook("repository.list", $args);
return $objList;
}
/**
Expand Down Expand Up @@ -1062,6 +1065,12 @@ public function getRepositoryByIdInst($repoId)
CacheService::save("repository:".$repoId, $repo);
return $repo;
}
$hookedRepo = null;
$args = array($repoId, &$hookedRepo);
AJXP_Controller::applyIncludeHook("repository.search", $args);
if($hookedRepo !== null){
return $hookedRepo;
}
return null;
}

Expand Down

0 comments on commit bcefb89

Please sign in to comment.