本文整理汇总了PHP中ConfService::getAccessibleRepositories方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfService::getAccessibleRepositories方法的具体用法?PHP ConfService::getAccessibleRepositories怎么用?PHP ConfService::getAccessibleRepositories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfService
的用法示例。
在下文中一共展示了ConfService::getAccessibleRepositories方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getChildren
public function getChildren()
{
$this->children = array();
$u = AuthService::getLoggedUser();
if ($u != null) {
$repos = ConfService::getAccessibleRepositories($u);
// Refilter to make sure the driver is an AjxpWebdavProvider
foreach ($repos as $repository) {
$accessType = $repository->getAccessType();
$driver = AJXP_PluginsService::getInstance()->getPluginByTypeName("access", $accessType);
if (is_a($driver, "AjxpWrapperProvider") && $repository->getOption("AJXP_WEBDAV_DISABLED") !== true) {
$this->children[$repository->getSlug()] = new Sabre\DAV\SimpleCollection($repository->getSlug());
}
}
}
return $this->children;
}
示例2: writeRepositoriesData
/**
* Write the repositories access rights in XML format
* @static
* @param AbstractAjxpUser|null $loggedUser * @internal param bool $details
* @return string
*/
public static function writeRepositoriesData($loggedUser)
{
$st = "<repositories>";
$streams = ConfService::detectRepositoryStreams(false);
$exposed = array();
$cacheHasExposed = AJXP_PluginsService::getInstance()->loadFromPluginQueriesCache("//server_settings/param[contains(@scope,'repository') and @expose='true']");
if ($cacheHasExposed !== null && is_array($cacheHasExposed)) {
$exposed = $cacheHasExposed;
} else {
$exposed_props = AJXP_PluginsService::searchAllManifests("//server_settings/param[contains(@scope,'repository') and @expose='true']", "node", false, false, true);
foreach ($exposed_props as $exposed_prop) {
$pluginId = $exposed_prop->parentNode->parentNode->getAttribute("id");
$paramName = $exposed_prop->getAttribute("name");
$paramDefault = $exposed_prop->getAttribute("default");
$exposed[] = array("PLUGIN_ID" => $pluginId, "NAME" => $paramName, "DEFAULT" => $paramDefault);
}
AJXP_PluginsService::getInstance()->storeToPluginQueriesCache("//server_settings/param[contains(@scope,'repository') and @expose='true']", $exposed);
}
$accessible = ConfService::getAccessibleRepositories($loggedUser, false, false);
$inboxStatus = 0;
foreach ($accessible as $repoId => $repoObject) {
if (!$repoObject->hasContentFilter()) {
continue;
}
$accessStatus = $repoObject->getAccessStatus();
if (empty($accessStatus) && $loggedUser != null) {
$lastConnected = $loggedUser->getArrayPref("repository_last_connected", $repoId);
if (empty($lastConnected)) {
$accessStatus = 1;
}
}
if (!empty($accessStatus)) {
$inboxStatus++;
}
}
foreach ($accessible as $repoId => $repoObject) {
if (!isset($_SESSION["CURRENT_MINISITE"]) && $repoObject->hasContentFilter()) {
continue;
}
$accessStatus = '';
if ($repoObject->getAccessType() == "inbox") {
$accessStatus = $inboxStatus;
}
$xmlString = self::repositoryToXML($repoId, $repoObject, $exposed, $streams, $loggedUser, $accessStatus);
$st .= $xmlString;
}
$st .= "</repositories>";
return $st;
}
示例3: writeRepositoriesData
/**
* Write the repositories access rights in XML format
* @static
* @param AbstractAjxpUser|null $loggedUser * @internal param bool $details
* @return string
*/
public static function writeRepositoriesData($loggedUser)
{
$st = "<repositories>";
$streams = ConfService::detectRepositoryStreams(false);
$exposed = array();
$cacheHasExposed = AJXP_PluginsService::getInstance()->loadFromPluginQueriesCache("//server_settings/param[contains(@scope,'repository') and @expose='true']");
if ($cacheHasExposed !== null && is_array($cacheHasExposed)) {
$exposed = $cacheHasExposed;
} else {
$exposed_props = AJXP_PluginsService::searchAllManifests("//server_settings/param[contains(@scope,'repository') and @expose='true']", "node", false, false, true);
foreach ($exposed_props as $exposed_prop) {
$pluginId = $exposed_prop->parentNode->parentNode->getAttribute("id");
$paramName = $exposed_prop->getAttribute("name");
$paramDefault = $exposed_prop->getAttribute("default");
$exposed[] = array("PLUGIN_ID" => $pluginId, "NAME" => $paramName, "DEFAULT" => $paramDefault);
}
AJXP_PluginsService::getInstance()->storeToPluginQueriesCache("//server_settings/param[contains(@scope,'repository') and @expose='true']", $exposed);
}
$accessible = ConfService::getAccessibleRepositories($loggedUser, false, false);
foreach ($accessible as $repoId => $repoObject) {
$rightString = "";
$streamString = "";
if (in_array($repoObject->accessType, $streams)) {
$streamString = "allowCrossRepositoryCopy=\"true\"";
}
if ($repoObject->getUniqueUser()) {
$streamString .= " user_editable_repository=\"true\" ";
}
$slugString = "";
$slug = $repoObject->getSlug();
if (!empty($slug)) {
$slugString = "repositorySlug=\"{$slug}\"";
}
$isSharedString = "";
if ($repoObject->hasOwner()) {
$uId = $repoObject->getOwner();
$uObject = ConfService::getConfStorageImpl()->createUserObject($uId);
$label = $uObject->personalRole->filterParameterValue("core.conf", "USER_DISPLAY_NAME", AJXP_REPO_SCOPE_ALL, $uId);
if (empty($label)) {
$label = $uId;
}
$isSharedString = 'owner="' . AJXP_Utils::xmlEntities($label) . '"';
}
$descTag = "";
$public = false;
if (!empty($_SESSION["CURRENT_MINISITE"])) {
$public = true;
}
$description = $repoObject->getDescription($public);
if (!empty($description)) {
$descTag = '<description>' . AJXP_Utils::xmlEntities($description, true) . '</description>';
}
$roleString = "";
if ($loggedUser != null) {
$merged = $loggedUser->mergedRole;
$params = array();
foreach ($exposed as $exposed_prop) {
$metaOptions = $repoObject->getOption("META_SOURCES");
if (!isset($metaOptions[$exposed_prop["PLUGIN_ID"]])) {
continue;
}
$value = $exposed_prop["DEFAULT"];
if (isset($metaOptions[$exposed_prop["PLUGIN_ID"]][$exposed_prop["NAME"]])) {
$value = $metaOptions[$exposed_prop["PLUGIN_ID"]][$exposed_prop["NAME"]];
}
$value = $merged->filterParameterValue($exposed_prop["PLUGIN_ID"], $exposed_prop["NAME"], $repoId, $value);
if ($value !== null) {
if ($value === true || $value === false) {
$value = $value === true ? "true" : "false";
}
$params[] = '<repository_plugin_param plugin_id="' . $exposed_prop["PLUGIN_ID"] . '" name="' . $exposed_prop["NAME"] . '" value="' . AJXP_Utils::xmlEntities($value) . '"/>';
$roleString .= str_replace(".", "_", $exposed_prop["PLUGIN_ID"]) . "_" . $exposed_prop["NAME"] . '="' . AJXP_Utils::xmlEntities($value) . '" ';
}
}
$roleString .= 'acl="' . $merged->getAcl($repoId) . '"';
if ($merged->hasMask($repoId)) {
$roleString .= ' hasMask="true" ';
}
}
$st .= "<repo access_type=\"" . $repoObject->accessType . "\" id=\"" . $repoId . "\"{$rightString} {$streamString} {$slugString} {$isSharedString} {$roleString}><label>" . SystemTextEncoding::toUTF8(AJXP_Utils::xmlEntities($repoObject->getDisplay())) . "</label>" . $descTag . $repoObject->getClientSettings() . "</repo>";
}
$st .= "</repositories>";
return $st;
}
示例4: getNodes
public static function getNodes($checkStats = false, $touch = true)
{
if (isset(self::$output)) {
return self::$output;
}
$mess = ConfService::getMessages();
$repos = ConfService::getAccessibleRepositories();
$output = array();
$touchReposIds = array();
foreach ($repos as $repo) {
if (!$repo->hasOwner() || !$repo->hasContentFilter()) {
continue;
}
$repoId = $repo->getId();
if (strpos("ocs_remote_share_", $repoId) !== 0) {
$touchReposIds[] = $repoId;
}
$url = "pydio://" . $repoId . "/";
$meta = array("shared_repository_id" => $repoId, "ajxp_description" => "File shared by " . $repo->getOwner() . " " . AJXP_Utils::relativeDate($repo->getOption("CREATION_TIME"), $mess), "share_meta_type" => 1);
$cFilter = $repo->getContentFilter();
$filter = $cFilter instanceof ContentFilter ? array_keys($cFilter->filters)[0] : $cFilter;
if (!is_array($filter)) {
$label = basename($filter);
} else {
$label = $repo->getDisplay();
}
if (strpos($repoId, "ocs_remote_share") !== 0) {
// FOR REMOTE SHARES, DO NOT APPEND THE DOCUMENTNAME, WE STAT THE ROOT DIRECTLY
$url .= $label;
}
$status = null;
$remoteShare = null;
$name = pathinfo($label, PATHINFO_FILENAME);
$ext = pathinfo($label, PATHINFO_EXTENSION);
$node = new AJXP_Node($url);
$node->setLabel($label);
if ($checkStats) {
$node->getRepository()->driverInstance = null;
try {
ConfService::loadDriverForRepository($node->getRepository());
} catch (Exception $e) {
$ext = "error";
$meta["ajxp_mime"] = "error";
}
$node->getRepository()->detectStreamWrapper(true);
$stat = @stat($url);
if ($stat === false) {
$ext = "error";
$meta["ajxp_mime"] = "error";
$meta["share_meta_type"] = 2;
} else {
if (strpos($repoId, "ocs_remote_share_") === 0) {
// Check Status
$linkId = str_replace("ocs_remote_share_", "", $repoId);
$ocsStore = new \Pydio\OCS\Model\SQLStore();
$remoteShare = $ocsStore->remoteShareById($linkId);
$status = $remoteShare->getStatus();
if ($status == OCS_INVITATION_STATUS_PENDING) {
$stat = stat(AJXP_Utils::getAjxpTmpDir());
$ext = "invitation";
$meta["ajxp_mime"] = "invitation";
$meta["share_meta_type"] = 0;
} else {
$meta["remote_share_accepted"] = "true";
}
$meta["remote_share_id"] = $remoteShare->getId();
}
}
if ($ext == "invitation") {
$label .= " (" . $mess["inbox_driver.4"] . ")";
} else {
if ($ext == "error") {
$label .= " (" . $mess["inbox_driver.5"] . ")";
}
}
if (is_array($stat) && AuthService::getLoggedUser() != null) {
$acl = AuthService::getLoggedUser()->mergedRole->getAcl($repoId);
if ($acl == "r") {
self::disableWriteInStat($stat);
}
}
}
$index = 0;
$suffix = "";
while (isset($output[$name . $suffix . "." . $ext])) {
$index++;
$suffix = " ({$index})";
}
$output[$name . $suffix . "." . $ext] = ["label" => $label, "url" => $url, "remote_share" => $remoteShare, "meta" => $meta];
if (isset($stat)) {
$output[$name . $suffix . "." . $ext]['stat'] = $stat;
}
}
ConfService::loadDriverForRepository(ConfService::getRepository());
self::$output = $output;
if ($touch) {
if (count($touchReposIds) && AuthService::getLoggedUser() != null) {
$uPref = AuthService::getLoggedUser()->getPref("repository_last_connected");
if (empty($uPref)) {
$uPref = array();
//.........这里部分代码省略.........
示例5: loadUserFeed
public function loadUserFeed($actionName, $httpVars, $fileVars)
{
if (!$this->eventStore) {
return array();
}
$u = AuthService::getLoggedUser();
if ($u == null) {
if ($httpVars["format"] == "html") {
return array();
}
AJXP_XMLWriter::header();
AJXP_XMLWriter::close();
return array();
}
$userId = $u->getId();
$userGroup = $u->getGroupPath();
$authRepos = array();
$crtRepId = ConfService::getCurrentRepositoryId();
if (isset($httpVars["repository_id"]) && $u->mergedRole->canRead($httpVars["repository_id"])) {
$authRepos[] = $httpVars["repository_id"];
} else {
if (isset($httpVars["current_repository"])) {
$authRepos[] = $crtRepId;
} else {
$accessibleRepos = ConfService::getAccessibleRepositories(AuthService::getLoggedUser(), false, true, false);
$authRepos = array_keys($accessibleRepos);
}
}
$offset = isset($httpVars["offset"]) ? intval($httpVars["offset"]) : 0;
$limit = isset($httpVars["limit"]) ? intval($httpVars["limit"]) : 15;
if (!isset($httpVars["feed_type"]) || $httpVars["feed_type"] == "notif" || $httpVars["feed_type"] == "all") {
$res = $this->eventStore->loadEvents($authRepos, isset($httpVars["path"]) ? $httpVars["path"] : "", $userGroup, $offset, $limit, false, $userId);
} else {
$res = array();
}
$mess = ConfService::getMessages();
$format = "html";
if (isset($httpVars["format"])) {
$format = $httpVars["format"];
}
if ($format == "html") {
echo "<h2>" . $mess["notification_center.4"] . "</h2>";
echo "<ul class='notification_list'>";
} else {
if ($format == "json") {
$jsonNodes = array();
} else {
if ($format != 'array') {
AJXP_XMLWriter::header();
}
}
}
// APPEND USER ALERT IN THE SAME QUERY FOR NOW
if (!isset($httpVars["feed_type"]) || $httpVars["feed_type"] == "alert" || $httpVars["feed_type"] == "all") {
$this->loadUserAlerts("", array_merge($httpVars, array("skip_container_tags" => "true")), $fileVars);
}
restore_error_handler();
$index = 1;
foreach ($res as $n => $object) {
$args = $object->arguments;
$oldNode = isset($args[0]) ? $args[0] : null;
$newNode = isset($args[1]) ? $args[1] : null;
$copy = isset($args[2]) && $args[2] === true ? true : null;
$notif = $this->generateNotificationFromChangeHook($oldNode, $newNode, $copy, "unify");
if ($notif !== false && $notif->getNode() !== false) {
$notif->setAuthor($object->author);
$notif->setDate(intval($object->date));
if ($format == "html") {
$p = $notif->getNode()->getPath();
echo "<li data-ajxpNode='{$p}'>";
echo $notif->getDescriptionShort(true);
echo "</li>";
} else {
$node = $notif->getNode();
if ($node == null) {
$this->logInfo("Warning", "Empty node stored in notification " . $notif->getAuthor() . "/ " . $notif->getAction());
continue;
}
try {
$node->loadNodeInfo();
} catch (Exception $e) {
continue;
}
$node->event_description = ucfirst($notif->getDescriptionBlock()) . " " . $mess["notification.tpl.block.user_link"] . " " . $notif->getAuthorLabel();
$node->event_description_long = $notif->getDescriptionLong(true);
$node->event_date = SystemTextEncoding::fromUTF8(AJXP_Utils::relativeDate($notif->getDate(), $mess));
$node->short_date = AJXP_Utils::relativeDate($notif->getDate(), $mess, true);
$node->event_time = $notif->getDate();
$node->event_type = "notification";
$node->event_id = $object->event_id;
if ($node->getRepository() != null) {
$node->repository_id = '' . $node->getRepository()->getId();
if ($node->repository_id != $crtRepId && $node->getRepository()->getDisplay() != null) {
$node->event_repository_label = "[" . $node->getRepository()->getDisplay() . "]";
}
}
$node->event_author = $notif->getAuthor();
// Replace PATH, to make sure they will be distinct children of the loader node
$node->real_path = $node->getPath();
$node->setLabel(basename($node->getPath()));
//.........这里部分代码省略.........
示例6: writeRepositoriesData
/**
* Write the repositories access rights in XML format
* @static
* @param AbstractAjxpUser|null $loggedUser
* @param bool $details
* @return string
*/
public static function writeRepositoriesData($loggedUser, $details = false)
{
$st = "<repositories>";
$streams = ConfService::detectRepositoryStreams(false);
foreach (ConfService::getAccessibleRepositories($loggedUser, $details, false) as $repoId => $repoObject) {
$toLast = false;
if ($repoObject->getAccessType() == "ajxp_conf") {
if (AuthService::usersEnabled() && !$loggedUser->isAdmin()) {
continue;
}
$toLast = true;
}
$rightString = "";
if ($details) {
$rightString = " r=\"" . ($loggedUser->canRead($repoId) ? "1" : "0") . "\" w=\"" . ($loggedUser->canWrite($repoId) ? "1" : "0") . "\"";
}
$streamString = "";
if (in_array($repoObject->accessType, $streams)) {
$streamString = "allowCrossRepositoryCopy=\"true\"";
}
if ($repoObject->getUniqueUser()) {
$streamString .= " user_editable_repository=\"true\" ";
}
$slugString = "";
$slug = $repoObject->getSlug();
if (!empty($slug)) {
$slugString = "repositorySlug=\"{$slug}\"";
}
$isSharedString = "";
if ($repoObject->hasOwner()) {
$uId = $repoObject->getOwner();
$uObject = ConfService::getConfStorageImpl()->createUserObject($uId);
$label = $uObject->personalRole->filterParameterValue("core.conf", "USER_DISPLAY_NAME", AJXP_REPO_SCOPE_ALL, $uId);
if (empty($label)) {
$label = $uId;
}
$isSharedString = 'owner="' . AJXP_Utils::xmlEntities($label) . '"';
}
$descTag = "";
$description = $repoObject->getDescription();
if (!empty($description)) {
$descTag = '<description>' . AJXP_Utils::xmlEntities($description, true) . '</description>';
}
$xmlString = "<repo access_type=\"" . $repoObject->accessType . "\" id=\"" . $repoId . "\"{$rightString} {$streamString} {$slugString} {$isSharedString}><label>" . SystemTextEncoding::toUTF8(AJXP_Utils::xmlEntities($repoObject->getDisplay())) . "</label>" . $descTag . $repoObject->getClientSettings() . "</repo>";
if ($toLast) {
$lastString = $xmlString;
} else {
$st .= $xmlString;
}
}
if (isset($lastString)) {
$st .= $lastString;
}
$st .= "</repositories>";
return $st;
}
示例7: switchAction
//.........这里部分代码省略.........
AJXP_XMLWriter::close();
break;
case "edit_role":
$roleId = SystemTextEncoding::magicDequote($httpVars["role_id"]);
$roleGroup = false;
if (strpos($roleId, "AJXP_GRP_") === 0) {
$groupPath = substr($roleId, strlen("AJXP_GRP_"));
$filteredGroupPath = AuthService::filterBaseGroup($groupPath);
$groups = AuthService::listChildrenGroups(AJXP_Utils::forwardSlashDirname($groupPath));
$key = "/" . basename($groupPath);
if (!array_key_exists($key, $groups)) {
throw new Exception("Cannot find group with this id!");
}
$roleId = "AJXP_GRP_" . $filteredGroupPath;
$groupLabel = $groups[$key];
$roleGroup = true;
}
if (strpos($roleId, "AJXP_USR_") === 0) {
$usrId = str_replace("AJXP_USR_/", "", $roleId);
$userObject = ConfService::getConfStorageImpl()->createUserObject($usrId);
if (!AuthService::canAdministrate($userObject)) {
throw new Exception("Cant find user!");
}
$role = $userObject->personalRole;
} else {
$role = AuthService::getRole($roleId, $roleGroup);
}
if ($role === false) {
throw new Exception("Cant find role! ");
}
if (isset($httpVars["format"]) && $httpVars["format"] == "json") {
HTMLWriter::charsetHeader("application/json");
$roleData = $role->getDataArray();
$repos = ConfService::getAccessibleRepositories($userObject, true, true, $userObject == null ? true : false);
$data = array("ROLE" => $roleData, "ALL" => array("REPOSITORIES" => $repos));
if (isset($userObject)) {
$data["USER"] = array();
$data["USER"]["LOCK"] = $userObject->getLock();
$data["USER"]["PROFILE"] = $userObject->getProfile();
$data["ALL"]["PROFILES"] = array("standard|Standard", "admin|Administrator", "shared|Shared", "guest|Guest");
$data["USER"]["ROLES"] = array_keys($userObject->getRoles());
$data["ALL"]["ROLES"] = array_keys(AuthService::getRolesList(array(), true));
if (isset($userObject->parentRole)) {
$data["PARENT_ROLE"] = $userObject->parentRole->getDataArray();
}
} else {
if (isset($groupPath)) {
$data["GROUP"] = array("PATH" => $groupPath, "LABEL" => $groupLabel);
}
}
$scope = "role";
if ($roleGroup) {
$scope = "group";
} else {
if (isset($userObject)) {
$scope = "user";
}
}
$data["SCOPE_PARAMS"] = array();
$nodes = AJXP_PluginsService::getInstance()->searchAllManifests("//param[contains(@scope,'" . $scope . "')]|//global_param[contains(@scope,'" . $scope . "')]", "node", false, true, true);
foreach ($nodes as $node) {
$pId = $node->parentNode->parentNode->attributes->getNamedItem("id")->nodeValue;
$origName = $node->attributes->getNamedItem("name")->nodeValue;
$node->attributes->getNamedItem("name")->nodeValue = "AJXP_REPO_SCOPE_ALL/" . $pId . "/" . $origName;
$nArr = array();
foreach ($node->attributes as $attrib) {