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

Commit

Permalink
Better handle of no repository or user locked case
Browse files Browse the repository at this point in the history
  • Loading branch information
cdujeu committed Sep 10, 2014
1 parent bd2f014 commit da79633
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 13 deletions.
2 changes: 1 addition & 1 deletion core/src/core/classes/class.AJXP_Controller.php
Expand Up @@ -94,7 +94,7 @@ public static function filterRegistryFromRole(&$registry)
}
$parameters = $loggedUser->mergedRole->listParameters();
foreach ($parameters as $scope => $paramsPlugs) {
if ($scope == AJXP_REPO_SCOPE_ALL || $scope == $crtRepoId || ($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: 2 additions & 0 deletions core/src/core/classes/class.ConfService.php
Expand Up @@ -563,7 +563,9 @@ protected function initRepositoriesListInst($scope = "user", $includeShared = tr
{
// APPEND CONF FILE REPOSITORIES
$loggedUser = AuthService::getLoggedUser();
$l = $loggedUser->getLock();
$objList = array();
if(!empty($l)) return $objList;
foreach ($this->configs["DEFAULT_REPOSITORIES"] as $index=>$repository) {
$repo = self::createRepositoryFromArray($index, $repository);
if($scope == "user" && $loggedUser != null && !self::repositoryIsAccessible($index, $repo, $loggedUser)){
Expand Down
11 changes: 7 additions & 4 deletions core/src/plugins/core.conf/class.AbstractConfDriver.php
Expand Up @@ -1110,10 +1110,13 @@ public function switchAction($action, $httpVars, $fileVars)
case "load_repository_info":

$data = array();
$users = AuthService::countUsersForRepository(ConfService::getRepository()->getId(), true);
$data["core.users"] = $users;
if(isSet($httpVars["collect"]) && $httpVars["collect"] == "true"){
AJXP_Controller::applyHook("repository.load_info", array(&$data));
$repo = ConfService::getRepository();
if($repo != null){
$users = AuthService::countUsersForRepository(ConfService::getRepository()->getId(), true);
$data["core.users"] = $users;
if(isSet($httpVars["collect"]) && $httpVars["collect"] == "true"){
AJXP_Controller::applyHook("repository.load_info", array(&$data));
}
}
HTMLWriter::charsetHeader("application/json");
echo json_encode($data);
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/gui.ajax/res/js/ajaxplorer.js

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions core/src/plugins/gui.ajax/res/js/ajaxplorer/class.Ajaxplorer.js
Expand Up @@ -143,11 +143,13 @@ Class.create("Ajaxplorer", {
if(this.user && this.user.getActiveRepository()){
var repoList = this.user.getRepositoriesList();
var activeRepo = repoList.get(this.user.getActiveRepository());
var slug = activeRepo.getSlug();
if(!activeRepo.getAccessType().startsWith("ajxp_")){
slug = "ws-" + slug;
if(activeRepo){
var slug = activeRepo.getSlug();
if(!activeRepo.getAccessType().startsWith("ajxp_")){
slug = "ws-" + slug;
}
this.router.navigate(slug);
}
this.router.navigate(slug);
}
var navigate = function(repList, repId){
if(repId === false){
Expand Down
Expand Up @@ -154,9 +154,11 @@ Class.create("InfoPanel", AjxpPane, {
var repoOptions = {};
if(ajaxplorer.user && ajaxplorer.user.getActiveRepository()){
var repo = ajaxplorer.user.repositories.get(ajaxplorer.user.getActiveRepository());
repoOptions = {
ws_label: repo.getLabel(),
ws_badge: repo.getHtmlBadge()
if(repo){
repoOptions = {
ws_label: repo.getLabel(),
ws_badge: repo.getHtmlBadge()
}
}
}

Expand Down

2 comments on commit da79633

@c12simple
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got an error on a fresh installation:
PHP Fatal error: Call to a member function getLock() on a non-object in /core/src/core/classes/class.ConfService.php on line 566

@cdujeu
Copy link
Member Author

@cdujeu cdujeu commented on da79633 Sep 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

of course.. thx tran, see 73c78cf
please confirm it's working

Please sign in to comment.