mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 15:22:17 +02:00
N°895 Portal: Filter linkedsets on remote object scopes
This commit is contained in:
@@ -835,6 +835,8 @@ class ObjectFormManager extends FormManager
|
||||
// - LinkedSet
|
||||
if (in_array(get_class($oField), array('Combodo\\iTop\\Form\\Field\\LinkedSetField')))
|
||||
{
|
||||
/** @var \Combodo\iTop\Form\Field\LinkedSetField $oField */
|
||||
/** @var \AttributeLinkedSetIndirect $oAttDef */
|
||||
// - Overriding attributes to display
|
||||
if ($this->oContainer !== null)
|
||||
{
|
||||
@@ -856,6 +858,32 @@ class ObjectFormManager extends FormManager
|
||||
}
|
||||
$oField->SetAttributesToDisplay($aAttributesToDisplay);
|
||||
}
|
||||
// - Filtering links regarding scopes
|
||||
if ($this->oContainer !== null)
|
||||
{
|
||||
$aLimitedAccessItemIDs = array();
|
||||
|
||||
/** @var \ormLinkSet $oFieldOriginalSet */
|
||||
$oFieldOriginalSet = $oField->GetCurrentValue();
|
||||
while ($oLink = $oFieldOriginalSet->Fetch())
|
||||
{
|
||||
if ($oField->IsIndirect())
|
||||
{
|
||||
$iRemoteKey = $oLink->Get($oAttDef->GetExtKeyToRemote());
|
||||
}
|
||||
else
|
||||
{
|
||||
$iRemoteKey = $oLink->GetKey();
|
||||
}
|
||||
|
||||
if (!$this->oContainer->get('security_helper')->IsActionAllowed(UR_ACTION_READ, $oField->GetTargetClass(), $iRemoteKey))
|
||||
{
|
||||
$aLimitedAccessItemIDs[] = $iRemoteKey;
|
||||
}
|
||||
}
|
||||
$oFieldOriginalSet->rewind();
|
||||
$oField->SetLimitedAccessItemIDs($aLimitedAccessItemIDs);
|
||||
}
|
||||
// - Displaying as opened
|
||||
if (array_key_exists($sAttCode, $aFieldsExtraData) && array_key_exists('opened', $aFieldsExtraData[$sAttCode]))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user