Merged in feature/PMCORE-3696 (pull request #8407)

PMCORE-3696

Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
Paula Quispe
2022-03-28 15:24:23 +00:00
committed by Julio Cesar Laura Avendaño

View File

@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\DB;
use ProcessMaker\Core\System;
use ProcessMaker\Model\Application;
use Publisher;
use RBAC;
use ResultSet;
use WebEntryPeer;
@@ -1101,7 +1102,7 @@ class WebEntry
*/
public function isWebEntryOne($weUid)
{
if (!empty($_SESSION['USER_LOGGED']) && empty($_SESSION['__WEBENTRYCONTINUE__'])) {
if ($this->verifyCurrentSession()) {
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/checkContinueOrCloseSession', '', [], SYS_URI . 'login/checkContinueOrCloseSession');
@@ -1116,6 +1117,28 @@ class WebEntry
&& $webEntry->getWeCallback() === 'PROCESSMAKER';
}
/**
* Verify the current sessión exist for display webentry message confirmation.
* @return bool
*/
private function verifyCurrentSession(): bool
{
//verify normal flow
$rule1 = !empty($_SESSION['USER_LOGGED']) && empty($_SESSION['__WEBENTRYCONTINUE__']);
//verify guest user
$rule2 = !empty($_SESSION['USER_LOGGED']);
if ($rule2) {
//verify is guest user uid.
$rule2 = !RBAC::isGuestUserUid($_SESSION['USER_LOGGED']);
}
//verify saml session
$rule3 = !(!empty($_SESSION['samlNameId']) && !empty($_SESSION['samlSessionIndex']));
return $rule1 && $rule2 && $rule3;
}
/**
* Verify if a Task is and Web Entry auxiliar task.
*