Skip to content
Snippets Groups Projects
Commit 1a22113a authored by Uma's avatar Uma
Browse files

Merge branch 'webservice_extendSession' into '7.4.0'

Webservice extendSession throwing Authentication failed error

See merge request !784
parents a95c10fc ef2cc9a2
No related branches found
No related tags found
No related merge requests found
......@@ -10,17 +10,19 @@
function vtws_extendSession(){
global $adb,$API_VERSION,$application_unique_key;
if(isset($_SESSION["authenticated_user_id"]) && $_SESSION["app_unique_key"] == $application_unique_key){
$userId = $_SESSION["authenticated_user_id"];
$sessionManager = new SessionManager();
$sessionManager->set("authenticatedUserId", $userId);
$crmObject = VtigerWebserviceObject::fromName($adb,"Users");
$userId = vtws_getId($crmObject->getEntityId(),$userId);
$vtigerVersion = vtws_getVtigerVersion();
$resp = array("sessionName"=>$sessionManager->getSessionId(),"userId"=>$userId,"version"=>$API_VERSION,"vtigerVersion"=>$vtigerVersion);
return $resp;
}else{
throw new WebServiceException(WebServiceErrorCode::$AUTHFAILURE,"Authencation Failed");
}
if($_SESSION['authenticatedUserId'] || (isset($_SESSION["authenticated_user_id"]) && $_SESSION["app_unique_key"] == $application_unique_key)){
$userId = ($_SESSION["authenticated_user_id"]) ? $_SESSION["authenticated_user_id"] : $_SESSION['authenticatedUserId'];
//unsetting as session manager will set it, if set then it is not extended by HTTP_Session::setExpire
unset($_SESSION['__HTTP_Session_Expire_TS']);
$sessionManager = new SessionManager();
$sessionManager->set("authenticatedUserId", $userId);
$crmObject = VtigerWebserviceObject::fromName($adb,"Users");
$userId = vtws_getId($crmObject->getEntityId(),$userId);
$vtigerVersion = vtws_getVtigerVersion();
$resp = array("sessionName"=>$sessionManager->getSessionId(),"userId"=>$userId,"version"=>$API_VERSION,"vtigerVersion"=>$vtigerVersion);
return $resp;
}else{
throw new WebServiceException(WebServiceErrorCode::$AUTHFAILURE,"Authencation Failed");
}
}
?>
\ No newline at end of file
......@@ -463,22 +463,9 @@ class HTTP_Session2
*/
public static function useCookies($useCookies = null)
{
$return = false;
if (ini_get('session.use_cookies') == '1') {
$return = true;
}
if ($useCookies !== null) {
if ($useCookies === true) {
$status = ini_set('session.use_cookies', 1);
} else {
$status = ini_set('session.use_cookies', 0);
}
if ($status === false) {
$msg = "Could not set 'session.use_cookies'. Please check your ";
$msg .= 'permissions to override php.ini-settings. E.g. a possible ';
$msg .= 'php_admin_value setting or blocked ini_set() calls ';
throw new HTTP_Session2_Exception($msg, self::ERR_SYSTEM_PERM);
}
$return = ini_get('session.use_cookies') ? true : false;
if (isset($useCookies)) {
ini_set('session.use_cookies', $useCookies ? 1 : 0);
}
return $return;
}
......
......@@ -8,7 +8,7 @@
* All Rights Reserved.
********************************************************************************/
require_once("config.php");
require_once("config.php");
/**
* URL Verfication - Required to overcome Apache mis-configuration and leading to shared setup mode.
*/
......@@ -90,7 +90,7 @@
// Workaround fix for PHP 5.3.x: $_REQUEST doesn't have PHPSESSID
if(isset($_REQUEST['PHPSESSID'])) {
$sessionId = vtws_getParameter($_REQUEST,"PHPSESSID");
} else {
} else if(isset($_COOKIE['PHPSESSID'])) { //if not set its creating new session
// NOTE: Need to evaluate for possible security issues
$sessionId = vtws_getParameter($_COOKIE,'PHPSESSID');
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment