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


PHP AuthService::usersEnabled方法代码示例

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


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

示例1: filter

 /**
  * Filter the very basic keywords from the XML  : AJXP_USER, AJXP_INSTALL_PATH, AJXP_DATA_PATH
  * Calls the vars.filter hooks.
  * @static
  * @param $value
  * @return mixed|string
  */
 public static function filter($value)
 {
     if (is_string($value) && strpos($value, "AJXP_USER") !== false) {
         if (AuthService::usersEnabled()) {
             $loggedUser = AuthService::getLoggedUser();
             if ($loggedUser != null) {
                 $loggedUser = $loggedUser->getId();
                 $value = str_replace("AJXP_USER", $loggedUser, $value);
             } else {
                 return "";
             }
         } else {
             $value = str_replace("AJXP_USER", "shared", $value);
         }
     }
     if (is_string($value) && strpos($value, "AJXP_INSTALL_PATH") !== false) {
         $value = str_replace("AJXP_INSTALL_PATH", AJXP_INSTALL_PATH, $value);
     }
     if (is_string($value) && strpos($value, "AJXP_DATA_PATH") !== false) {
         $value = str_replace("AJXP_DATA_PATH", AJXP_DATA_PATH, $value);
     }
     $tab = array(&$value);
     AJXP_Controller::applyIncludeHook("vars.filter", $tab);
     return $value;
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:32,代码来源:class.AJXP_VarsFilter.php

示例2: parseSpecificContributions

 public function parseSpecificContributions(&$contribNode)
 {
     parent::parseSpecificContributions($contribNode);
     if ($contribNode->nodeName != "actions") {
         return;
     }
     $actionXpath = new DOMXPath($contribNode->ownerDocument);
     $paramList = $actionXpath->query('action[@name="scheduler_addTask"]/processing/standardFormDefinition/param[@name="repository_id"]', $contribNode);
     if (!$paramList->length) {
         return;
     }
     $paramNode = $paramList->item(0);
     $sVals = array();
     $repos = ConfService::getRepositoriesList("all");
     foreach ($repos as $repoId => $repoObject) {
         $sVals[] = $repoId . "|" . AJXP_Utils::xmlEntities($repoObject->getDisplay());
     }
     $sVals[] = "*|All Repositories";
     $paramNode->attributes->getNamedItem("choices")->nodeValue = implode(",", $sVals);
     if (!AuthService::usersEnabled() || AuthService::getLoggedUser() == null) {
         return;
     }
     $paramList = $actionXpath->query('action[@name="scheduler_addTask"]/processing/standardFormDefinition/param[@name="user_id"]', $contribNode);
     if (!$paramList->length) {
         return;
     }
     $paramNode = $paramList->item(0);
     $paramNode->attributes->getNamedItem("default")->nodeValue = AuthService::getLoggedUser()->getId();
 }
开发者ID:rbrdevs,项目名称:pydio-core,代码行数:29,代码来源:class.AjxpScheduler.php

示例3: doTest

 public function doTest()
 {
     $this->testedParams["Users enabled"] = AuthService::usersEnabled();
     $this->testedParams["Guest enabled"] = ConfService::getCoreConf("ALLOW_GUEST_BROWSING", "auth");
     $this->failedLevel = "info";
     return FALSE;
 }
开发者ID:biggtfish,项目名称:cms,代码行数:7,代码来源:test.UsersConfig.php

示例4: filter

 /**
  * Filter the very basic keywords from the XML  : AJXP_USER, AJXP_INSTALL_PATH, AJXP_DATA_PATH
  * Calls the vars.filter hooks.
  * @static
  * @param $value
  * @param AbstractAjxpUser|String $resolveUser
  * @return mixed|string
  */
 public static function filter($value, $resolveUser = null)
 {
     if (is_string($value) && strpos($value, "AJXP_USER") !== false) {
         if (AuthService::usersEnabled()) {
             if ($resolveUser != null) {
                 if (is_string($resolveUser)) {
                     $resolveUserId = $resolveUser;
                 } else {
                     $resolveUserId = $resolveUser->getId();
                 }
                 $value = str_replace("AJXP_USER", $resolveUserId, $value);
             } else {
                 $loggedUser = AuthService::getLoggedUser();
                 if ($loggedUser != null) {
                     if ($loggedUser->hasParent() && $loggedUser->getResolveAsParent()) {
                         $loggedUserId = $loggedUser->getParent();
                     } else {
                         $loggedUserId = $loggedUser->getId();
                     }
                     $value = str_replace("AJXP_USER", $loggedUserId, $value);
                 } else {
                     return "";
                 }
             }
         } else {
             $value = str_replace("AJXP_USER", "shared", $value);
         }
     }
     if (is_string($value) && strpos($value, "AJXP_GROUP_PATH") !== false) {
         if (AuthService::usersEnabled()) {
             if ($resolveUser != null) {
                 if (is_string($resolveUser) && AuthService::userExists($resolveUser)) {
                     $loggedUser = ConfService::getConfStorageImpl()->createUserObject($resolveUser);
                 } else {
                     $loggedUser = $resolveUser;
                 }
             } else {
                 $loggedUser = AuthService::getLoggedUser();
             }
             if ($loggedUser != null) {
                 $gPath = $loggedUser->getGroupPath();
                 $value = str_replace("AJXP_GROUP_PATH_FLAT", str_replace("/", "_", trim($gPath, "/")), $value);
                 $value = str_replace("AJXP_GROUP_PATH", $gPath, $value);
             } else {
                 return "";
             }
         } else {
             $value = str_replace(array("AJXP_GROUP_PATH", "AJXP_GROUP_PATH_FLAT"), "shared", $value);
         }
     }
     if (is_string($value) && strpos($value, "AJXP_INSTALL_PATH") !== false) {
         $value = str_replace("AJXP_INSTALL_PATH", AJXP_INSTALL_PATH, $value);
     }
     if (is_string($value) && strpos($value, "AJXP_DATA_PATH") !== false) {
         $value = str_replace("AJXP_DATA_PATH", AJXP_DATA_PATH, $value);
     }
     $tab = array(&$value);
     AJXP_Controller::applyIncludeHook("vars.filter", $tab);
     return $value;
 }
开发者ID:andy737,项目名称:pydio-core,代码行数:68,代码来源:class.AJXP_VarsFilter.php

示例5: applyChangeLock

 /**
  * @param string $action
  * @param array $httpVars
  * @param array $fileVars
  */
 public function applyChangeLock($actionName, $httpVars, $fileVars)
 {
     if (!isset($this->actions[$actionName])) {
         return;
     }
     if (is_a($this->accessDriver, "demoAccessDriver")) {
         throw new Exception("Write actions are disabled in demo mode!");
     }
     $repo = $this->accessDriver->repository;
     $user = AuthService::getLoggedUser();
     if (!AuthService::usersEnabled() && $user != null && !$user->canWrite($repo->getId())) {
         throw new Exception("You have no right on this action.");
     }
     $selection = new UserSelection();
     $selection->initFromHttpVars();
     $currentFile = $selection->getUniqueFile();
     $wrapperData = $this->accessDriver->detectStreamWrapper(false);
     $urlBase = $wrapperData["protocol"] . "://" . $this->accessDriver->repository->getId();
     $unlock = isset($httpVars["unlock"]) ? true : false;
     $ajxpNode = new AJXP_Node($urlBase . $currentFile);
     if ($unlock) {
         $this->metaStore->removeMetadata($ajxpNode, self::METADATA_LOCK_NAMESPACE, false, AJXP_METADATA_SCOPE_GLOBAL);
     } else {
         $this->metaStore->setMetadata($ajxpNode, SimpleLockManager::METADATA_LOCK_NAMESPACE, array("lock_user" => AuthService::getLoggedUser()->getId()), false, AJXP_METADATA_SCOPE_GLOBAL);
     }
     AJXP_XMLWriter::header();
     AJXP_XMLWriter::reloadDataNode();
     AJXP_XMLWriter::close();
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:34,代码来源:class.SimpleLockManager.php

示例6: getUserId

 protected function getUserId()
 {
     if (AuthService::usersEnabled()) {
         return AuthService::getLoggedUser()->getId();
     }
     return "shared";
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:7,代码来源:class.SerialMetaStore.php

示例7: repositoryDataAsJS

 function repositoryDataAsJS()
 {
     if (AuthService::usersEnabled()) {
         return "";
     }
     require_once INSTALL_PATH . "/server/classes/class.SystemTextEncoding.php";
     require_once INSTALL_PATH . "/server/classes/class.AJXP_XMLWriter.php";
     return str_replace("'", "\\'", AJXP_XMLWriter::writeRepositoriesData(null));
 }
开发者ID:bloveing,项目名称:openulteo,代码行数:9,代码来源:class.HTMLWriter.php

示例8: repositoryDataAsJS

 /**
  * Write repository data directly as javascript string
  * @static
  * @return mixed|string
  */
 public static function repositoryDataAsJS()
 {
     if (AuthService::usersEnabled()) {
         return "";
     }
     require_once AJXP_BIN_FOLDER . "/class.SystemTextEncoding.php";
     require_once AJXP_BIN_FOLDER . "/class.AJXP_XMLWriter.php";
     return str_replace("'", "\\'", AJXP_XMLWriter::writeRepositoriesData(null));
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:14,代码来源:class.HTMLWriter.php

示例9: getUserId

 protected function getUserId($private)
 {
     if (!$private) {
         return AJXP_METADATA_SHAREDUSER;
     }
     if (AuthService::usersEnabled()) {
         return AuthService::getLoggedUser()->getId();
     }
     return "shared";
 }
开发者ID:biggtfish,项目名称:cms,代码行数:10,代码来源:class.xAttrMetaStore.php

示例10: getRegistryContributions

 public function getRegistryContributions()
 {
     $logged = AuthService::getLoggedUser();
     if (AuthService::usersEnabled()) {
         if ($logged == null) {
             return $this->registryContributions;
         } else {
             $xmlString = AJXP_XMLWriter::getUserXml($logged, false);
         }
     } else {
         $xmlString = AJXP_XMLWriter::getUserXml(null, false);
     }
     $dom = new DOMDocument();
     $dom->loadXML($xmlString);
     $this->registryContributions[] = $dom->documentElement;
     return $this->registryContributions;
 }
开发者ID:umbecr,项目名称:camilaframework,代码行数:17,代码来源:class.AbstractAuthDriver.php

示例11: formatMessage

 /**
  * formats the error message in representable manner
  *
  * For the SQL driver we will normalise the information into our table row format.
  *
  * @param $message String this is the message to be formatted
  * @param $severity Severity level of the message: one of LOG_LEVEL_* (DEBUG,INFO,NOTICE,WARNING,ERROR)
  * @return String the formatted message.
  */
 function formatMessage($message, $severity)
 {
     // Get the user if it exists
     $user = "No User";
     if (AuthService::usersEnabled()) {
         $logged = AuthService::getLoggedUser();
         if ($logged != null) {
             $user = $logged->getId();
         } else {
             $user = "shared";
         }
     }
     $message_parts = explode("\t", $message);
     $severity = strtoupper((string) $severity);
     $log_row = array('logdate' => $this->toMysqlDateTime(strtotime('NOW')), 'remote_ip' => $this->inet_ptod($_SERVER['REMOTE_ADDR']), 'severity' => $severity, 'user' => $user, 'message' => $message_parts[0], 'params' => $message_parts[1]);
     return $log_row;
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:26,代码来源:class.sqlLogDriver.php

示例12: receiveAction

 public function receiveAction($action, $httpVars, $filesVars)
 {
     $provider = $this->getFilteredOption("AVATAR_PROVIDER");
     $type = $this->getFilteredOption("GRAVATAR_TYPE");
     if ($action == "get_avatar_url") {
         $url = "";
         $suffix = "";
         switch ($provider) {
             case "gravatar":
             default:
                 if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
                     $url = "https://secure.gravatar.com";
                 } else {
                     $url = "http://www.gravatar.com";
                 }
                 $url .= "/avatar/";
                 $suffix .= "?s=80&r=g&d=" . $type;
                 break;
             case "libravatar":
                 $url = "";
                 // Federated Servers are not supported here without libravatar.org. Should query DNS server first.
                 if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') {
                     $url = "https://seccdn.libravatar.org";
                 } else {
                     $url = "http://cdn.libravatar.org";
                 }
                 $url .= "/avatar/";
                 $suffix = "?s=80&d=" . $type;
                 break;
         }
         if (isset($httpVars["userid"])) {
             $userid = $httpVars["userid"];
             if (AuthService::usersEnabled() && AuthService::userExists($userid)) {
                 $confDriver = ConfService::getConfStorageImpl();
                 $user = $confDriver->createUserObject($userid);
                 $userEmail = $user->personalRole->filterParameterValue("core.conf", "email", AJXP_REPO_SCOPE_ALL, "");
                 if (!empty($userEmail)) {
                     $url .= md5(strtolower(trim($userEmail)));
                 }
             }
         }
         $url .= $suffix;
         print $url;
     }
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:45,代码来源:class.AvatarProvider.php

示例13: applyChangeLock

 /**
  * @param string $action
  * @param array $httpVars
  * @param array $fileVars
  */
 public function applyChangeLock($actionName, $httpVars, $fileVars)
 {
     if (is_a($this->accessDriver, "demoAccessDriver")) {
         throw new Exception("Write actions are disabled in demo mode!");
     }
     $repo = $this->accessDriver->repository;
     $user = AuthService::getLoggedUser();
     if (!AuthService::usersEnabled() && $user != null && !$user->canWrite($repo->getId())) {
         throw new Exception("You have no right on this action.");
     }
     $selection = new UserSelection($repo, $httpVars);
     $unlock = isset($httpVars["unlock"]) ? true : false;
     if ($unlock) {
         $this->metaStore->removeMetadata($selection->getUniqueNode(), self::METADATA_LOCK_NAMESPACE, false, AJXP_METADATA_SCOPE_GLOBAL);
     } else {
         $this->metaStore->setMetadata($selection->getUniqueNode(), SimpleLockManager::METADATA_LOCK_NAMESPACE, array("lock_user" => AuthService::getLoggedUser()->getId()), false, AJXP_METADATA_SCOPE_GLOBAL);
     }
     AJXP_XMLWriter::header();
     AJXP_XMLWriter::reloadDataNode();
     AJXP_XMLWriter::close();
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:26,代码来源:class.SimpleLockManager.php

示例14: suscribeToChannel

 /**
  * @param $channelName
  * @param $clientId
  * @throws Exception
  * @return mixed
  */
 public function suscribeToChannel($channelName, $clientId)
 {
     $this->loadChannel($channelName, true);
     if (AuthService::usersEnabled()) {
         $user = AuthService::getLoggedUser();
         if ($user == null) {
             throw new Exception("You must be logged in");
         }
         $GROUP_PATH = $user->getGroupPath();
         $USER_ID = $user->getId();
     } else {
         $GROUP_PATH = '/';
         $USER_ID = 'shared';
     }
     if ($GROUP_PATH == null) {
         $GROUP_PATH = false;
     }
     $this->channels[$channelName]["CLIENTS"][$clientId] = array("ALIVE" => time(), "USER_ID" => $USER_ID, "GROUP_PATH" => $GROUP_PATH);
     foreach ($this->channels[$channelName]["MESSAGES"] as &$object) {
         $object->messageRC[$clientId] = $clientId;
     }
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:28,代码来源:class.AJXP_SerialMessageExchanger.php

示例15: switchAction

 public function switchAction($action, $httpVars, $fileVars)
 {
     if (!isset($this->actions[$action])) {
         return;
     }
     $xmlBuffer = "";
     foreach ($httpVars as $getName => $getValue) {
         ${$getName} = AJXP_Utils::securePath($getValue);
     }
     if (isset($dir) && $action != "upload") {
         $dir = SystemTextEncoding::fromUTF8($dir);
     }
     $mess = ConfService::getMessages();
     switch ($action) {
         //------------------------------------
         //	SWITCH THE ROOT REPOSITORY
         //------------------------------------
         case "switch_repository":
             if (!isset($repository_id)) {
                 break;
             }
             $dirList = ConfService::getRepositoriesList();
             /** @var $repository_id string */
             if (!isset($dirList[$repository_id])) {
                 $errorMessage = "Trying to switch to an unkown repository!";
                 break;
             }
             ConfService::switchRootDir($repository_id);
             // Load try to init the driver now, to trigger an exception
             // if it's not loading right.
             ConfService::loadRepositoryDriver();
             if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
                 $user = AuthService::getLoggedUser();
                 $activeRepId = ConfService::getCurrentRepositoryId();
                 $user->setArrayPref("history", "last_repository", $activeRepId);
                 $user->save("user");
             }
             //$logMessage = "Successfully Switched!";
             $this->logInfo("Switch Repository", array("rep. id" => $repository_id));
             break;
             //------------------------------------
             //	SEND XML REGISTRY
             //------------------------------------
         //------------------------------------
         //	SEND XML REGISTRY
         //------------------------------------
         case "get_xml_registry":
         case "state":
             $regDoc = AJXP_PluginsService::getXmlRegistry();
             $changes = AJXP_Controller::filterRegistryFromRole($regDoc);
             if ($changes) {
                 AJXP_PluginsService::updateXmlRegistry($regDoc);
             }
             $clone = $regDoc->cloneNode(true);
             $clonePath = new DOMXPath($clone);
             $serverCallbacks = $clonePath->query("//serverCallback|hooks");
             foreach ($serverCallbacks as $callback) {
                 $callback->parentNode->removeChild($callback);
             }
             $xPath = '';
             if (isset($httpVars["xPath"])) {
                 $xPath = ltrim(AJXP_Utils::securePath($httpVars["xPath"]), "/");
             }
             if (!empty($xPath)) {
                 $nodes = $clonePath->query($xPath);
                 if ($httpVars["format"] == "json") {
                     $data = AJXP_XMLWriter::xmlToArray($nodes->item(0));
                     HTMLWriter::charsetHeader("application/json");
                     echo json_encode($data);
                 } else {
                     AJXP_XMLWriter::header("ajxp_registry_part", array("xPath" => $xPath));
                     if ($nodes->length) {
                         print AJXP_XMLWriter::replaceAjxpXmlKeywords($clone->saveXML($nodes->item(0)));
                     }
                     AJXP_XMLWriter::close("ajxp_registry_part");
                 }
             } else {
                 AJXP_Utils::safeIniSet("zlib.output_compression", "4096");
                 if ($httpVars["format"] == "json") {
                     $data = AJXP_XMLWriter::xmlToArray($clone);
                     HTMLWriter::charsetHeader("application/json");
                     echo json_encode($data);
                 } else {
                     header('Content-Type: application/xml; charset=UTF-8');
                     print AJXP_XMLWriter::replaceAjxpXmlKeywords($clone->saveXML());
                 }
             }
             break;
             //------------------------------------
             //	BOOKMARK BAR
             //------------------------------------
         //------------------------------------
         //	BOOKMARK BAR
         //------------------------------------
         case "get_bookmarks":
             $bmUser = null;
             if (AuthService::usersEnabled() && AuthService::getLoggedUser() != null) {
                 $bmUser = AuthService::getLoggedUser();
             } else {
                 if (!AuthService::usersEnabled()) {
//.........这里部分代码省略.........
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:101,代码来源:class.AbstractConfDriver.php


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