From 289877699afb1a3802a82f2f56b6b9a039482f55 Mon Sep 17 00:00:00 2001 From: Roly Gutierrez Date: Fri, 25 Mar 2022 16:43:01 -0400 Subject: [PATCH] PMCORE-3697 If I have a Current Enabled SAML Setting and SAML Session, don't show the message --- .../ProcessMaker/BusinessModel/WebEntry.php | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php index c5e25cdf9..883f49d73 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php @@ -1102,7 +1102,7 @@ class WebEntry */ public function isWebEntryOne($weUid) { - if (!empty($_SESSION['USER_LOGGED']) && empty($_SESSION['__WEBENTRYCONTINUE__']) && !RBAC::isGuestUserUid($_SESSION['USER_LOGGED'])) { + if ($this->verifyCurrentSession()) { global $G_PUBLISH; $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/checkContinueOrCloseSession', '', [], SYS_URI . 'login/checkContinueOrCloseSession'); @@ -1117,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. *