$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; } } } } /* * Checks if requiring SAML authentication on current URL makes sense when
private static function unsetAttributes() { $expires = time() - 3600; /*setcookie("oc_display_name", '', $expires, \OC::$WEBROOT); setcookie("oc_mail", '', $expires, \OC::$WEBROOT); setcookie("oc_quota", '', $expires, \OC::$WEBROOT); setcookie("oc_groups", '', $expires, \OC::$WEBROOT);*/ $cookiedomain = OCP\App::isEnabled('files_sharding') ? OCA\FilesSharding\Lib::getCookieDomain() : null; setcookie(self::$LOGIN_OK_COOKIE, "", $expires, \OC::$WEBROOT, $cookiedomain); unset($_SESSION["oc_display_name"]); unset($_SESSION["oc_mail"]); unset($_SESSION["oc_groups"]); unset($_SESSION["oc_quota"]); unset($_SESSION["oc_data_folders"]); unset($_SESSION["oc_storage_id"]); unset($_SESSION["oc_numeric_storage_id"]); }
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]); }