N°985 - Add applicable contexts on Trigger

This commit is contained in:
Eric
2020-01-20 15:50:08 +01:00
parent 2fcea4d02e
commit 900e8ac6d7
21 changed files with 366 additions and 93 deletions

View File

@@ -23,7 +23,7 @@ use Symfony\Component\HttpFoundation\Request;
require_once MODULESROOT.'itop-portal-base/portal/config/bootstrap.php';
// Stacking context tag so it knows we are in the portal
$oContext = new ContextTag('GUI:Portal');
$oContext = new ContextTag(ContextTag::TAG_PORTAL);
$oContext2 = new ContextTag('Portal:' . $_ENV['PORTAL_ID']);
// Note: Manually refactored ternary condition to be PHP 5.x compatible

View File

@@ -100,7 +100,7 @@ abstract class AbstractPortalUrlMaker implements iDBObjectURLMaker
switch ($sMode)
{
case 'view':
if (!ContextTag::Check('GUI:Portal') || $oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sClass, $iId))
if (!ContextTag::Check(ContextTag::TAG_PORTAL) || $oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sClass, $iId))
{
$sObjectQueryString = $oUrlGenerator->generate('p_object_view', array('sObjectClass' => $sClass, 'sObjectId' => $iId));
}
@@ -109,11 +109,11 @@ abstract class AbstractPortalUrlMaker implements iDBObjectURLMaker
case 'edit':
default:
// Checking if user is allowed to edit object, if not we check if it can at least view it.
if (!ContextTag::Check('GUI:Portal') || $oSecurityHelper->IsActionAllowed(UR_ACTION_MODIFY, $sClass, $iId))
if (!ContextTag::Check(ContextTag::TAG_PORTAL) || $oSecurityHelper->IsActionAllowed(UR_ACTION_MODIFY, $sClass, $iId))
{
$sObjectQueryString = $oUrlGenerator->generate('p_object_edit', array('sObjectClass' => $sClass, 'sObjectId' => $iId));
}
elseif (!ContextTag::Check('GUI:Portal') || $oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sClass, $iId))
elseif (!ContextTag::Check(ContextTag::TAG_PORTAL) || $oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $sClass, $iId))
{
$sObjectQueryString = $oUrlGenerator->generate('p_object_view', array('sObjectClass' => $sClass, 'sObjectId' => $iId));
}