当前位置: 首页>>代码示例>>PHP>>正文


PHP AuthService::countUsersForRepository方法代码示例

本文整理汇总了PHP中AuthService::countUsersForRepository方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthService::countUsersForRepository方法的具体用法?PHP AuthService::countUsersForRepository怎么用?PHP AuthService::countUsersForRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AuthService的用法示例。


在下文中一共展示了AuthService::countUsersForRepository方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: switchAction


//.........这里部分代码省略.........
                     $users .= "<li class='complete_group_entry' data-group='/AJXP_TEAM/{$tId}' data-label='[team] " . $tData["LABEL"] . "'><span class='user_entry_label'>[team] " . $tData["LABEL"] . "</span></li>";
                 }
             }
             foreach ($allUsers as $userId => $userObject) {
                 if ($userObject->getId() == $loggedUser->getId()) {
                     continue;
                 }
                 if (!$userObject->hasParent() && ConfService::getCoreConf("ALLOW_CROSSUSERS_SHARING", "conf") || $userObject->getParent() == $loggedUser->getId()) {
                     $userLabel = $userObject->personalRole->filterParameterValue("core.conf", "USER_DISPLAY_NAME", AJXP_REPO_SCOPE_ALL, $userId);
                     //if($regexp != null && ! (preg_match("/$regexp/i", $userId) || preg_match("/$regexp/i", $userLabel)) ) continue;
                     if (empty($userLabel)) {
                         $userLabel = $userId;
                     }
                     $userDisplay = $userLabel == $userId ? $userId : $userLabel . " ({$userId})";
                     if (ConfService::getCoreConf("USERS_LIST_HIDE_LOGIN", "conf") == true && $userLabel != $userId) {
                         $userDisplay = $userLabel;
                     }
                     $users .= "<li class='complete_user_entry' data-label='{$userLabel}' data-entry_id='{$userId}'><span class='user_entry_label'>" . $userDisplay . "</span></li>";
                     $index++;
                 }
                 if ($index == $limit) {
                     break;
                 }
             }
             if (strlen($users)) {
                 print "<ul>" . $users . "</ul>";
             }
             AuthService::setGroupFiltering(true);
             break;
         case "load_repository_info":
             $data = array();
             $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);
             break;
         case "get_binary_param":
             if (isset($httpVars["tmp_file"])) {
                 $file = AJXP_Utils::getAjxpTmpDir() . "/" . AJXP_Utils::securePath($httpVars["tmp_file"]);
                 if (isset($file)) {
                     header("Content-Type:image/png");
                     readfile($file);
                 }
             } else {
                 if (isset($httpVars["binary_id"])) {
                     if (isset($httpVars["user_id"]) && AuthService::getLoggedUser() != null && AuthService::getLoggedUser()->isAdmin()) {
                         $context = array("USER" => $httpVars["user_id"]);
                     } else {
                         $context = array("USER" => AuthService::getLoggedUser()->getId());
                     }
                     $this->loadBinary($context, $httpVars["binary_id"]);
                 }
             }
             break;
         case "get_global_binary_param":
             if (isset($httpVars["tmp_file"])) {
                 $file = AJXP_Utils::getAjxpTmpDir() . "/" . AJXP_Utils::securePath($httpVars["tmp_file"]);
                 if (isset($file)) {
                     header("Content-Type:image/png");
                     readfile($file);
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:67,代码来源:class.AbstractConfDriver.php

示例2: shareToJson

 /**
  * @param String $shareId
  * @param array $shareMeta
  * @param AJXP_Node $node
  * @throws Exception
  * @return array|bool
  */
 public function shareToJson($shareId, $shareMeta, $node = null)
 {
     $messages = ConfService::getMessages();
     $jsonData = array();
     $elementWatch = false;
     if ($shareMeta["type"] == "file") {
         require_once "class.LegacyPubliclet.php";
         $jsonData = LegacyPubliclet::publicletToJson($shareId, $shareMeta, $this->getShareStore(), $this->getPublicAccessManager(), $this->watcher, $node);
     } else {
         if ($shareMeta["type"] == "minisite" || $shareMeta["type"] == "repository") {
             $repoId = $shareId;
             if (strpos($repoId, "repo-") === 0) {
                 // Legacy
                 $repoId = str_replace("repo-", "", $repoId);
                 $shareMeta["type"] = "repository";
             }
             $minisite = $shareMeta["type"] == "minisite";
             if ($minisite) {
                 $shareLink = $this->getShareStore()->loadShareObject($shareId);
                 $repoId = $shareLink->getRepositoryId();
             }
             $notExistsData = array("error" => true, "repositoryId" => $repoId, "users_number" => 0, "label" => "Error - Cannot find shared data", "description" => "Cannot find repository", "entries" => array(), "element_watch" => false, "repository_url" => "");
             $repo = ConfService::getRepositoryById($repoId);
             if ($repoId == null || $repo == null && $node != null) {
                 if ($minisite) {
                     $this->getShareStore()->getMetaManager()->removeShareFromMeta($node, $shareId);
                 }
                 return $notExistsData;
             }
             try {
                 $this->getShareStore()->testUserCanEditShare($repo->getOwner(), $repo->options);
             } catch (Exception $e) {
                 $notExistsData["label"] = $e->getMessage();
                 return $notExistsData;
             }
             if ($this->watcher != false && $node != null) {
                 $elementWatch = $this->watcher->hasWatchOnNode(new AJXP_Node("pydio://" . $repoId . "/"), AuthService::getLoggedUser()->getId(), MetaWatchRegister::$META_WATCH_NAMESPACE);
             }
             if ($node != null) {
                 $sharedEntries = $this->getRightsManager()->computeSharedRepositoryAccessRights($repoId, true, new AJXP_Node("pydio://" . $repoId . "/"));
             } else {
                 $sharedEntries = $this->getRightsManager()->computeSharedRepositoryAccessRights($repoId, true, null);
             }
             if (empty($sharedEntries) && $minisite) {
                 $this->getShareStore()->getMetaManager()->removeShareFromMeta($node, $shareId);
                 return $notExistsData;
             }
             $cFilter = $repo->getContentFilter();
             if (!empty($cFilter)) {
                 $cFilter = $cFilter->toArray();
             }
             $jsonData = array("repositoryId" => $repoId, "users_number" => AuthService::countUsersForRepository($repoId), "label" => $repo->getDisplay(), "description" => $repo->getDescription(), "entries" => $sharedEntries, "element_watch" => $elementWatch, "repository_url" => AJXP_Utils::getWorkspaceShortcutURL($repo) . "/", "content_filter" => $cFilter, "share_owner" => $repo->getOwner(), "share_scope" => isset($repo->options["SHARE_ACCESS"]) ? $repo->options["SHARE_ACCESS"] : "private");
             if ($minisite && isset($shareLink)) {
                 $shareLink->setAdditionalMeta($shareMeta);
                 $jsonData["minisite"] = $shareLink->getJsonData($this->getPublicAccessManager(), $messages);
             }
         }
     }
     return $jsonData;
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:67,代码来源:class.ShareCenter.php

示例3: switchAction


//.........这里部分代码省略.........
                     $parentLabel = $parent->getDisplay();
                     $parentType = $parent->getAccessType();
                     print "<template repository_id=\"" . $repository->getParentId() . "\" repository_label=\"{$parentLabel}\" repository_type=\"{$parentType}\">";
                     foreach ($parent->getOptionsDefined() as $parentOptionName) {
                         print "<option name=\"{$parentOptionName}\"/>";
                     }
                     print "</template>";
                 }
             }
             $manifest = $plug->getManifestRawContent("server_settings/param");
             $manifest = AJXP_XMLWriter::replaceAjxpXmlKeywords($manifest);
             $clientSettings = $plug->getManifestRawContent("client_settings", "xml");
             $iconClass = "";
             $descriptionTemplate = "";
             if ($clientSettings->length) {
                 $iconClass = $clientSettings->item(0)->getAttribute("iconClass");
                 $descriptionTemplate = $clientSettings->item(0)->getAttribute("description_template");
             }
             print "<ajxpdriver name=\"" . $repository->accessType . "\" label=\"" . AJXP_Utils::xmlEntities($plug->getManifestLabel()) . "\" iconClass=\"{$iconClass}\" description_template=\"{$descriptionTemplate}\" description=\"" . AJXP_Utils::xmlEntities($plug->getManifestDescription()) . "\">{$manifest}</ajxpdriver>";
             print "<metasources>";
             $metas = $pServ->getPluginsByType("metastore");
             $metas = array_merge($metas, $pServ->getPluginsByType("meta"));
             $metas = array_merge($metas, $pServ->getPluginsByType("index"));
             foreach ($metas as $metaPlug) {
                 print "<meta id=\"" . $metaPlug->getId() . "\" label=\"" . AJXP_Utils::xmlEntities($metaPlug->getManifestLabel()) . "\" description=\"" . AJXP_Utils::xmlEntities($metaPlug->getManifestDescription()) . "\">";
                 $manifest = $metaPlug->getManifestRawContent("server_settings/param");
                 $manifest = AJXP_XMLWriter::replaceAjxpXmlKeywords($manifest);
                 print $manifest;
                 print "</meta>";
             }
             print "</metasources>";
             if (!$repository->isTemplate) {
                 print "<additional_info>";
                 $users = AuthService::countUsersForRepository($repId, false, true);
                 $shares = ConfService::getConfStorageImpl()->simpleStoreList("share", null, "", "serial", '', $repId);
                 print '<users total="' . $users . '"/>';
                 print '<shares total="' . count($shares) . '"/>';
                 $rootGroup = AuthService::getRole("AJXP_GRP_/");
                 if ($rootGroup !== false && $rootGroup->hasMask($repId)) {
                     print "<mask><![CDATA[" . json_encode($rootGroup->getMask($repId)) . "]]></mask>";
                 }
                 print "</additional_info>";
             }
             AJXP_XMLWriter::close("admin_data");
             break;
         case "edit_repository_label":
         case "edit_repository_data":
             $repId = $httpVars["repository_id"];
             $repo = ConfService::getRepositoryById($repId);
             if (!$repo->isWriteable()) {
                 if (isset($httpVars["permission_mask"]) && !empty($httpVars["permission_mask"])) {
                     $mask = json_decode($httpVars["permission_mask"], true);
                     $rootGroup = AuthService::getRole("AJXP_GRP_/");
                     if (count($mask)) {
                         $perm = new AJXP_PermissionMask($mask);
                         $rootGroup->setMask($repId, $perm);
                     } else {
                         $rootGroup->clearMask($repId);
                     }
                     AuthService::updateRole($rootGroup);
                     AJXP_XMLWriter::header();
                     AJXP_XMLWriter::sendMessage("The permission mask was updated for this workspace", null);
                     AJXP_XMLWriter::close();
                     break;
                 } else {
                     throw new Exception("This workspace is not writeable. Please edit directly the conf/bootstrap_repositories.php file.");
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:67,代码来源:class.ajxp_confAccessDriver.php

示例4: shareToJson

 /**
  * @param String $shareId
  * @param Array $shareData
  * @param AJXP_Node $node
  * @throws Exception
  * @return array|bool
  */
 public function shareToJson($shareId, $shareData, $node = null)
 {
     $messages = ConfService::getMessages();
     $jsonData = array();
     $elementWatch = false;
     if ($shareData["type"] == "file") {
         $pData = $this->getShareStore()->loadShare($shareId);
         if (!count($pData)) {
             return false;
         }
         foreach ($this->getShareStore()->modifiableShareKeys as $key) {
             if (isset($pData[$key])) {
                 $shareData[$key] = $pData[$key];
             }
         }
         if ($pData["OWNER_ID"] != AuthService::getLoggedUser()->getId() && !AuthService::getLoggedUser()->isAdmin()) {
             throw new Exception($messages["share_center.48"]);
         }
         if (isset($shareData["short_form_url"])) {
             $link = $shareData["short_form_url"];
         } else {
             $link = $this->buildPublicletLink($shareId);
         }
         if ($this->watcher != false && $node != null) {
             $result = array();
             $elementWatch = $this->watcher->hasWatchOnNode($node, AuthService::getLoggedUser()->getId(), MetaWatchRegister::$META_WATCH_USERS_NAMESPACE, $result);
             if ($elementWatch && !in_array($shareId, $result)) {
                 $elementWatch = false;
             }
         }
         $jsonData = array_merge(array("element_id" => $shareId, "publiclet_link" => $link, "download_counter" => $this->getShareStore()->getCurrentDownloadCounter($shareId), "download_limit" => $pData["DOWNLOAD_LIMIT"], "expire_time" => $pData["EXPIRE_TIME"] != 0 ? date($messages["date_format"], $pData["EXPIRE_TIME"]) : 0, "has_password" => !empty($pData["PASSWORD"]), "element_watch" => $elementWatch, "is_expired" => $this->shareStore->isShareExpired($shareId, $pData)), $shareData);
     } else {
         if ($shareData["type"] == "minisite" || $shareData["type"] == "repository") {
             $repoId = $shareId;
             if (strpos($repoId, "repo-") === 0) {
                 // Legacy
                 $repoId = str_replace("repo-", "", $repoId);
                 $shareData["type"] = "repository";
             }
             $minisite = $shareData["type"] == "minisite";
             $minisiteIsPublic = false;
             $dlDisabled = false;
             $minisiteLink = '';
             if ($minisite) {
                 $minisiteData = $this->getShareStore()->loadShare($shareId);
                 $repoId = $minisiteData["REPOSITORY"];
                 $minisiteIsPublic = isset($minisiteData["PRELOG_USER"]);
                 $dlDisabled = isset($minisiteData["DOWNLOAD_DISABLED"]) && $minisiteData["DOWNLOAD_DISABLED"] === true;
                 if (isset($shareData["short_form_url"])) {
                     $minisiteLink = $shareData["short_form_url"];
                 } else {
                     $minisiteLink = $this->buildPublicletLink($shareId);
                 }
             }
             $notExistsData = array("error" => true, "repositoryId" => $repoId, "users_number" => 0, "label" => "Error - Cannot find shared data", "description" => "Cannot find repository", "entries" => array(), "element_watch" => false, "repository_url" => "");
             $repo = ConfService::getRepositoryById($repoId);
             if ($repoId == null || $repo == null && $node != null) {
                 if ($minisite) {
                     $this->removeShareFromMeta($node, $shareId);
                 }
                 return $notExistsData;
             } else {
                 if (!AuthService::getLoggedUser()->isAdmin() && $repo->getOwner() != AuthService::getLoggedUser()->getId()) {
                     return $notExistsData;
                 }
             }
             if ($this->watcher != false && $node != null) {
                 $elementWatch = $this->watcher->hasWatchOnNode(new AJXP_Node($this->baseProtocol . "://" . $repoId . "/"), AuthService::getLoggedUser()->getId(), MetaWatchRegister::$META_WATCH_NAMESPACE);
             }
             if ($node != null) {
                 $sharedEntries = $this->computeSharedRepositoryAccessRights($repoId, true, $node->getUrl());
             } else {
                 $sharedEntries = $this->computeSharedRepositoryAccessRights($repoId, true, null);
             }
             $cFilter = $repo->getContentFilter();
             if (!empty($cFilter)) {
                 $cFilter = $cFilter->toArray();
             }
             $jsonData = array("repositoryId" => $repoId, "users_number" => AuthService::countUsersForRepository($repoId), "label" => $repo->getDisplay(), "description" => $repo->getDescription(), "entries" => $sharedEntries, "element_watch" => $elementWatch, "repository_url" => AJXP_Utils::detectServerURL(true) . "?goto=" . $repo->getSlug() . "/", "content_filter" => $cFilter);
             if (isset($minisiteData)) {
                 if (!empty($minisiteData["DOWNLOAD_LIMIT"]) && !$dlDisabled) {
                     $jsonData["download_counter"] = $this->getShareStore()->getCurrentDownloadCounter($shareId);
                     $jsonData["download_limit"] = $minisiteData["DOWNLOAD_LIMIT"];
                 }
                 if (!empty($minisiteData["EXPIRE_TIME"])) {
                     $delta = $minisiteData["EXPIRE_TIME"] - time();
                     $days = round($delta / (60 * 60 * 24));
                     $jsonData["expire_time"] = date($messages["date_format"], $minisiteData["EXPIRE_TIME"]);
                     $jsonData["expire_after"] = $days;
                 } else {
                     $jsonData["expire_after"] = 0;
                 }
                 $jsonData["is_expired"] = $this->shareStore->isShareExpired($shareId, $minisiteData);
//.........这里部分代码省略.........
开发者ID:saydulk,项目名称:pydio-core,代码行数:101,代码来源:class.ShareCenter.php

示例5: toJson

 /**
  * @param MetaWatchRegister|false $watcher
  * @param ShareRightsManager $rightsManager
  * @param PublicAccessManager $publicAccessManager
  * @param array $messages
  * @return array|false
  */
 public function toJson($watcher, $rightsManager, $publicAccessManager, $messages)
 {
     $repoRootNode = new AJXP_Node("pydio://" . $this->getRepositoryId() . "/");
     $elementWatch = false;
     if ($watcher != false) {
         $elementWatch = $watcher->hasWatchOnNode($repoRootNode, AuthService::getLoggedUser()->getId(), MetaWatchRegister::$META_WATCH_NAMESPACE);
     }
     $sharedEntries = $rightsManager->computeSharedRepositoryAccessRights($this->getRepositoryId(), true, $repoRootNode);
     if (empty($sharedEntries)) {
         return false;
     }
     $cFilter = $this->getRepository()->getContentFilter();
     if (!empty($cFilter)) {
         $cFilter = $cFilter->toArray();
     }
     $jsonData = array("repositoryId" => $this->getRepositoryId(), "users_number" => AuthService::countUsersForRepository($this->getRepositoryId()), "label" => $this->getRepository()->getDisplay(), "description" => $this->getRepository()->getDescription(), "entries" => $sharedEntries, "element_watch" => $elementWatch, "repository_url" => AJXP_Utils::getWorkspaceShortcutURL($this->getRepository()) . "/", "content_filter" => $cFilter, "share_owner" => $this->getOwner(), "share_scope" => $this->getVisibilityScope());
     $jsonData["links"] = array();
     foreach ($this->shareLinks as $shareLink) {
         $uniqueUser = $shareLink->getUniqueUser();
         $found = false;
         foreach ($sharedEntries as $entry) {
             if ($entry["ID"] == $uniqueUser) {
                 $found = true;
             }
         }
         if (!$found) {
             // STRANGE, THE ASSOCIATED USER IS MISSING
             error_log("Found shareLink orphan with uniqueUser " . $uniqueUser);
             continue;
         }
         $jsonData["links"][$shareLink->getHash()] = $shareLink->getJsonData($publicAccessManager, $messages);
     }
     return $jsonData;
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:41,代码来源:class.CompositeShare.php


注:本文中的AuthService::countUsersForRepository方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。