Add functionality in rbac for enable or disable compatibility with soap login
This commit is contained in:
@@ -2577,18 +2577,37 @@ class Bootstrap
|
||||
return $var;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify Hash password with password entered
|
||||
*
|
||||
* @param string $pass password
|
||||
* @param string $userPass hash of password
|
||||
* @return bool true or false
|
||||
*/
|
||||
public function verifyHashPassword ($pass, $userPass)
|
||||
{
|
||||
global $RBAC;
|
||||
$passwordHashConfig = Bootstrap::getPasswordHashConfig();
|
||||
$hashTypeCurrent = $passwordHashConfig['current'];
|
||||
$hashTypePrevious = $passwordHashConfig['previous'];
|
||||
$acceptance = false;
|
||||
|
||||
if ($RBAC->getStatusLoginHash()) {
|
||||
//To enable compatibility with soap login
|
||||
if ($pass === $hashTypeCurrent . ':' . $userPass) {
|
||||
$acceptance = true;
|
||||
} else if ($pass === $hashTypePrevious . ':' . $userPass) {
|
||||
$acceptance = true;
|
||||
}
|
||||
} else {
|
||||
if (Bootstrap::hashPassword($pass, $hashTypeCurrent) == $userPass) {
|
||||
return true;
|
||||
$acceptance = true;
|
||||
} else if (Bootstrap::hashPassword($pass, $hashTypePrevious) == $userPass) {
|
||||
$acceptance = true;
|
||||
}
|
||||
if (Bootstrap::hashPassword($pass, $hashTypePrevious) == $userPass) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
return $acceptance;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -75,6 +75,12 @@ class RBAC
|
||||
private static $instance = null;
|
||||
public $authorizedActions = array();
|
||||
|
||||
/**
|
||||
* To enable compatibility with soap login.
|
||||
* @var bool
|
||||
*/
|
||||
private $enableLoginHash = false;
|
||||
|
||||
public function __construct ()
|
||||
{
|
||||
$this->authorizedActions = array(
|
||||
@@ -1572,5 +1578,31 @@ class RBAC
|
||||
throw new RBACException('ID_ACCESS_DENIED', 403);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable compatibility with soap login
|
||||
*/
|
||||
public function enableLoginSoapWithHash()
|
||||
{
|
||||
$this->enableLoginHash = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable compatibility with soap login
|
||||
*/
|
||||
public function disableLoginSoapWithHash ()
|
||||
{
|
||||
$this->enableLoginHash = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return status login with soap
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getStatusLoginHash ()
|
||||
{
|
||||
return $this->enableLoginHash;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
require_once(__DIR__ . '/../../../bootstrap/autoload.php');
|
||||
try {
|
||||
//Set variables
|
||||
$cronName = pathinfo($_SERVER['SCRIPT_FILENAME'], PATHINFO_FILENAME);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
require_once(__DIR__ . '/../../../bootstrap/autoload.php');
|
||||
register_shutdown_function(
|
||||
create_function(
|
||||
'',
|
||||
|
||||
@@ -65,6 +65,8 @@ class wsBase
|
||||
global $RBAC;
|
||||
|
||||
try {
|
||||
//To enable compatibility with soap login, method Enable.
|
||||
$RBAC->enableLoginSoapWithHash();
|
||||
$uid = $RBAC->VerifyLogin( $userid, $password );
|
||||
|
||||
switch ($uid) {
|
||||
@@ -113,14 +115,13 @@ class wsBase
|
||||
$session->Save();
|
||||
|
||||
//save the session in DataBase
|
||||
|
||||
|
||||
return $wsResponse;
|
||||
} catch (Exception $e) {
|
||||
$wsResponse = unserialize( $e->getMessage() );
|
||||
|
||||
return $wsResponse;
|
||||
}
|
||||
|
||||
//To enable compatibility with soap login, method disable.
|
||||
$RBAC->disableLoginSoapWithHash();
|
||||
return $wsResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
ini_set("soap.wsdl_cache_enabled", 0); //disabling WSDL cache
|
||||
|
||||
use ProcessMaker\Util\ParseSoapVariableName;
|
||||
|
||||
define( 'WEB_SERVICE_VERSION', '2.0' );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user