Пример #1
0
         $error = true;
         OC_Log::write('saml', 'Error trying to authenticate the user', OC_Log::DEBUG);
     }
     if (isset($_GET["linktoapp"])) {
         $path = OC::$WEBROOT . '/?app=' . $_GET["linktoapp"];
         if (isset($_GET["linktoargs"])) {
             $path .= '&' . urldecode($_GET["linktoargs"]);
         }
         header('Location: ' . $path);
         exit;
     }
     OC::$REQUESTEDAPP = '';
     OC_Util::redirectToDefaultPage();
 }
 // We load the login prompt only if we're stand-alone or on the sharding master
 if (!OCP\User::isLoggedIn() && (!OCP\App::isEnabled('files_sharding') || \OCA\FilesSharding\Lib::isMaster())) {
     // Load js code in order to render the SAML link and to hide parts of the normal login form
     OCP\Util::addScript('user_saml', 'utils');
 }
 if (OCP\App::isEnabled('files_sharding') && OCP\User::isLoggedIn() && strlen($_SERVER['REQUEST_URI']) > 1 && strpos($_SERVER['REQUEST_URI'], '/index.php/settings') === FALSE && strpos($_SERVER['REQUEST_URI'], 'logout') === FALSE && strpos($_SERVER['REQUEST_URI'], '/ajax/') === FALSE && strpos($_SERVER['REQUEST_URI'], '/jqueryFileTree.php') === FALSE && strpos($_SERVER['REQUEST_URI'], '/ws/') === FALSE) {
     $userid = \OCP\User::getUser();
     $redirect = OCA\FilesSharding\Lib::getServerForUser($userid);
     if (!empty($redirect)) {
         $parsedRedirect = parse_url($redirect);
         if ($_SERVER['HTTP_HOST'] !== $parsedRedirect['host']) {
             $redirect_full = preg_replace("/(\\?*)app=user_saml(\\&*)/", "\$1", $redirect . $_SERVER['REQUEST_URI']);
             OC_USER_SAML_Hooks::setRedirectCookie();
             OC_Log::write('user_saml', 'Redirecting to ' . $redirect_full, OC_Log::WARN);
             header("HTTP/1.1 301 Moved Permanently");
             header('Location: ' . $redirect_full);
             exit;
Пример #2
0
 public function userExists($uid)
 {
     // This is only for ajax/ws calls when sharing
     if (\OCP\App::isEnabled('files_sharding') && !OCA\FilesSharding\Lib::isMaster() && empty(OC_User::getUser())) {
         $userExists = \OCA\FilesSharding\Lib::ws('userExists', array('user_id' => $uid));
         return $userExists;
     }
     $this->loadUser($uid);
     return !empty($this->cache[$uid]);
 }