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


PHP AuthService类代码示例

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


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

示例1: getUserId

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

示例2: 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

示例3: preProcess

 public function preProcess($action, $httpVars, $fileVars)
 {
     if (!is_array($this->pluginConf) || !isset($this->pluginConf["TO"])) {
         throw new Exception("Cannot find configuration for plugin notify.phpmail-lite! Make sur the .inc file was dropped inside the /server/conf/ folder!");
     }
     require "lib/class.phpmailer-lite.php";
     $mail = new PHPMailerLite(true);
     $mail->Mailer = $this->pluginConf["MAILER"];
     $mail->SetFrom($this->pluginConf["FROM"]["address"], $this->pluginConf["FROM"]["name"]);
     foreach ($this->pluginConf["TO"] as $address) {
         $mail->AddAddress($address["address"], $address["name"]);
     }
     $mail->WordWrap = 50;
     // set word wrap to 50 characters
     $mail->IsHTML(true);
     // set email format to HTML
     $mail->Subject = $this->pluginConf["SUBJECT"];
     $mail->Body = str_replace("%user", AuthService::getLoggedUser()->getId(), $this->pluginConf["BODY"]);
     $mail->AltBody = strip_tags($mail->Body);
     if (!$mail->Send()) {
         $message = "Message could not be sent. <p>";
         $message .= "Mailer Error: " . $mail->ErrorInfo;
         throw new Exception($message);
     }
 }
开发者ID:firstcoder55,项目名称:Webkey,代码行数:25,代码来源:class.PhpMailLiteNotifier.php

示例4: 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

示例5: load

 function load()
 {
     $serialDir = $this->storage->getOption("USERS_DIRPATH");
     $this->rights = AJXP_Utils::loadSerialFile($serialDir . "/" . $this->getId() . "/rights.ser");
     $this->prefs = AJXP_Utils::loadSerialFile($serialDir . "/" . $this->getId() . "/prefs.ser");
     $this->bookmarks = AJXP_Utils::loadSerialFile($serialDir . "/" . $this->getId() . "/bookmarks.ser");
     if (isset($this->rights["ajxp.admin"]) && $this->rights["ajxp.admin"] === true) {
         $this->setAdmin(true);
     }
     if (isset($this->rights["ajxp.parent_user"])) {
         $this->setParent($this->rights["ajxp.parent_user"]);
     }
     // Load roles
     if (isset($this->rights["ajxp.roles"])) {
         //$allRoles = $this->storage->listRoles();
         $allRoles = AuthService::getRolesList();
         // Maintained as instance variable
         foreach (array_keys($this->rights["ajxp.roles"]) as $roleId) {
             if (isset($allRoles[$roleId])) {
                 $this->roles[$roleId] = $allRoles[$roleId];
             } else {
                 unset($this->rights["ajxp.roles"][$roleId]);
             }
         }
     }
 }
开发者ID:pussbb,项目名称:CI_DEV_CMS,代码行数:26,代码来源:class.AJXP_User.php

示例6: authenticate

 public function authenticate(Sabre\DAV\Server $server, $realm)
 {
     //AJXP_Logger::debug("Try authentication on $realm", $server);
     try {
         $success = parent::authenticate($server, $realm);
     } catch (Exception $e) {
         $success = 0;
         $errmsg = $e->getMessage();
         if ($errmsg != "No digest authentication headers were found") {
             $success = false;
         }
     }
     if ($success) {
         $res = AuthService::logUser($this->currentUser, null, true);
         if ($res < 1) {
             throw new Sabre\DAV\Exception\NotAuthenticated();
         }
         $this->updateCurrentUserRights(AuthService::getLoggedUser());
         if (ConfService::getCoreConf("SESSION_SET_CREDENTIALS", "auth")) {
             $webdavData = AuthService::getLoggedUser()->getPref("AJXP_WEBDAV_DATA");
             AJXP_Safe::storeCredentials($this->currentUser, $this->_decodePassword($webdavData["PASS"], $this->currentUser));
         }
     } else {
         if ($success === false) {
             AJXP_Logger::warning(__CLASS__, "Login failed", array("user" => $this->currentUser, "error" => "Invalid WebDAV user or password"));
         }
         throw new Sabre\DAV\Exception\NotAuthenticated($errmsg);
     }
     ConfService::switchRootDir($this->repositoryId);
     return true;
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:31,代码来源:class.AJXP_Sabre_AuthBackendDigest.php

示例7: 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

示例8: toggleDisclaimer

 public function toggleDisclaimer($actionName, $httpVars, $fileVars)
 {
     $u = AuthService::getLoggedUser();
     $u->personalRole->setParameterValue("action.disclaimer", "DISCLAIMER_ACCEPTED", $httpVars["validate"] == "true" ? "yes" : "no", AJXP_REPO_SCOPE_ALL);
     if ($httpVars["validate"] == "true") {
         $u->removeLock();
         $u->save("superuser");
         AuthService::updateUser($u);
         ConfService::switchUserToActiveRepository($u);
         $force = $u->mergedRole->filterParameterValue("core.conf", "DEFAULT_START_REPOSITORY", AJXP_REPO_SCOPE_ALL, -1);
         $passId = -1;
         if ($force != "" && $u->canSwitchTo($force) && !isset($httpVars["tmp_repository_id"]) && !isset($_SESSION["PENDING_REPOSITORY_ID"])) {
             $passId = $force;
         }
         $res = ConfService::switchUserToActiveRepository($u, $passId);
         if (!$res) {
             AuthService::disconnect();
             AJXP_XMLWriter::header();
             AJXP_XMLWriter::requireAuth(true);
             AJXP_XMLWriter::close();
         }
         ConfService::getInstance()->invalidateLoadedRepositories();
     } else {
         $u->setLock("validate_disclaimer");
         $u->save("superuser");
         AuthService::disconnect();
         AJXP_XMLWriter::header();
         AJXP_XMLWriter::requireAuth(true);
         AJXP_XMLWriter::close();
     }
 }
开发者ID:rbrdevs,项目名称:pydio-core,代码行数:31,代码来源:class.DisclaimerProvider.php

示例9: validateRequest

 public function validateRequest(sfWebRequest $request)
 {
     $server = $this->getOAuthServer();
     $oauthRequest = $this->getOAuthRequest();
     $oauthResponse = $this->getOAuthResponse();
     if (!$server->verifyResourceRequest($oauthRequest, $oauthResponse)) {
         $server->getResponse()->send();
         throw new sfStopException();
     }
     $tokenData = $server->getAccessTokenData($oauthRequest, $oauthResponse);
     $userId = $tokenData['user_id'];
     $userService = new SystemUserService();
     $user = $userService->getSystemUser($userId);
     $authService = new AuthService();
     $authService->setLoggedInUser($user);
     $this->getAuthenticationService()->setCredentialsForUser($user, array());
 }
开发者ID:lahirwisada,项目名称:orangehrm,代码行数:17,代码来源:OAuthService.php

示例10: 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

示例11: 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

示例12: validateUserPass

 /**
  * Validates a username and password
  *
  * This method should return true or false depending on if login
  * succeeded.
  *
  * @param string $username
  * @param string $password
  * @return bool
  */
 protected function validateUserPass($username, $password)
 {
     if (isset($this->shareData["PRESET_LOGIN"])) {
         $res = \AuthService::logUser($this->shareData["PRESET_LOGIN"], $password, false, false, -1);
     } else {
         $res = \AuthService::logUser($this->shareData["PRELOG_USER"], "", true);
     }
     return $res === 1;
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:19,代码来源:AuthSharingBackend.php

示例13: switchAction

 public function switchAction($action, $httpVars, $postProcessData)
 {
     if (!isset($this->actions[$action])) {
         return false;
     }
     $repository = ConfService::getRepository();
     if (!$repository->detectStreamWrapper(false)) {
         return false;
     }
     $plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
     $streamData = $plugin->detectStreamWrapper(true);
     $destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . "/";
     if ($action == "audio_proxy") {
         $file = AJXP_Utils::decodeSecureMagic(base64_decode($httpVars["file"]));
         $cType = "audio/" . array_pop(explode(".", $file));
         $localName = basename($file);
         header("Content-Type: " . $cType . "; name=\"" . $localName . "\"");
         header("Content-Length: " . filesize($destStreamURL . $file));
         $stream = fopen("php://output", "a");
         call_user_func(array($streamData["classname"], "copyFileInStream"), $destStreamURL . $file, $stream);
         fflush($stream);
         fclose($stream);
         $node = new AJXP_Node($destStreamURL . $file);
         AJXP_Controller::applyHook("node.read", array($node));
         //exit(1);
     } else {
         if ($action == "ls") {
             if (!isset($httpVars["playlist"])) {
                 // This should not happen anyway, because of the applyCondition.
                 AJXP_Controller::passProcessDataThrough($postProcessData);
                 return;
             }
             // We transform the XML into XSPF
             $xmlString = $postProcessData["ob_output"];
             $xmlDoc = new DOMDocument();
             $xmlDoc->loadXML($xmlString);
             $xElement = $xmlDoc->documentElement;
             header("Content-Type:application/xspf+xml;charset=UTF-8");
             print '<?xml version="1.0" encoding="UTF-8"?>';
             print '<playlist version="1" xmlns="http://xspf.org/ns/0/">';
             print "<trackList>";
             foreach ($xElement->childNodes as $child) {
                 $isFile = $child->getAttribute("is_file") == "true";
                 $label = $child->getAttribute("text");
                 $ar = explode(".", $label);
                 $ext = strtolower(end($ar));
                 if (!$isFile || $ext != "mp3") {
                     continue;
                 }
                 print "<track><location>" . AJXP_SERVER_ACCESS . "?secure_token=" . AuthService::getSecureToken() . "&get_action=audio_proxy&file=" . base64_encode($child->getAttribute("filename")) . "</location><title>" . $label . "</title></track>";
             }
             print "</trackList>";
             AJXP_XMLWriter::close("playlist");
         }
     }
 }
开发者ID:biggtfish,项目名称:cms,代码行数:56,代码来源:class.AudioPreviewer.php

示例14: upgradeRootRoleForWelcome

function upgradeRootRoleForWelcome()
{
    $rootRole = AuthService::getRole("ROOT_ROLE");
    if (!empty($rootRole)) {
        echo '<br>Upgrading Root Role to let users access the new welcome page<br>';
        $rootRole->setAcl("ajxp_home", "rw");
        $rootRole->setParameterValue("core.conf", "DEFAULT_START_REPOSITORY", "ajxp_home");
        AuthService::updateRole($rootRole);
    }
}
开发者ID:floffel03,项目名称:pydio-core,代码行数:10,代码来源:5.3.4.php

示例15: 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


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