/** * @param AbstractAjxpUser $user * @return Array */ public function listRepositories($user = null) { $all = AJXP_Utils::loadSerialFile($this->repoSerialFile); if ($user != null) { foreach ($all as $repoId => $repoObject) { if (!ConfService::repositoryIsAccessible($repoId, $repoObject, $user)) { unset($all[$repoId]); } } } return $all; }
/** * Test if user can switch to this repository * * @param integer $repositoryId * @return boolean */ public function canSwitchTo($repositoryId) { $repositoryObject = ConfService::getRepositoryById($repositoryId); if ($repositoryObject == null) { return false; } return ConfService::repositoryIsAccessible($repositoryId, $repositoryObject, $this, false, true); /* if($repositoryObject->getAccessType() == "ajxp_conf" && !$this->isAdmin()) return false; if($repositoryObject->getUniqueUser() && $this->id != $repositoryObject->getUniqueUser()) return false; return ($this->mergedRole->canRead($repositoryId) || $this->mergedRole->canWrite($repositoryId)) ; */ }
/** * @static * @param AbstractAjxpUser $userObject * @param bool $details * @param bool $labelOnly * @param bool $skipShared * @return Repository[] */ public static function getAccessibleRepositories($userObject = null, $details = false, $labelOnly = false, $includeShared = true) { $result = array(); $allReps = ConfService::getRepositoriesList("user"); foreach ($allReps as $repositoryId => $repositoryObject) { if (!ConfService::repositoryIsAccessible($repositoryId, $repositoryObject, $userObject, $details, $includeShared)) { continue; } if ($labelOnly) { $result[$repositoryId] = $repositoryObject->getDisplay(); } else { $result[$repositoryId] = $repositoryObject; } } return $result; }
$uri = substr($uri, strlen($scriptUri)); $uri = explode("/", trim($uri, "/")); // GET REPO ID $repoID = array_shift($uri); // GET ACTION NAME $action = array_shift($uri); $path = "/" . implode("/", $uri); if ($repoID == 'pydio') { ConfService::switchRootDir(); $repo = ConfService::getRepository(); } else { $repo = ConfService::findRepositoryByIdOrAlias($repoID); if ($repo == null) { die("Cannot find repository with ID " . $repoID); } if (!ConfService::repositoryIsAccessible($repo->getId(), $repo, AuthService::getLoggedUser(), false, true)) { header('HTTP/1.0 401 Unauthorized'); echo 'You are not authorized to access this workspace.'; exit; } ConfService::switchRootDir($repo->getId()); } // DRIVERS BELOW NEED IDENTIFICATION CHECK if (!AuthService::usersEnabled() || ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth") || AuthService::getLoggedUser() != null) { $confDriver = ConfService::getConfStorageImpl(); $Driver = ConfService::loadDriverForRepository($repo); } AJXP_PluginsService::getInstance()->initActivePlugins(); $xmlResult = AJXP_Controller::findRestActionAndApply($action, $path); if (!empty($xmlResult) && !headers_sent()) { AJXP_XMLWriter::header();