Skip to content

N°8528 - ignore silo not applied on 1:n linkedset displayed in form in portal#761

Open
accognet wants to merge 1 commit intodevelopfrom
feature/8528-ignore_silo_1_n_linkedset_in_portal
Open

N°8528 - ignore silo not applied on 1:n linkedset displayed in form in portal#761
accognet wants to merge 1 commit intodevelopfrom
feature/8528-ignore_silo_1_n_linkedset_in_portal

Conversation

@accognet
Copy link
Contributor

internal

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes portal linkedset scoping so that the “ignore silos” behavior is correctly applied for 1:n linkedsets displayed in portal forms.

Changes:

  • Apply portal scope (via ScopeValidatorHelper) to AttributeLinkedSet::GetDefaultValue() queries when running in portal context.
  • Optimize ormLinkSet index-building by reducing loaded columns and adjust iteration object loading behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
sources/Core/AttributeDefinition/AttributeLinkedSet.php Intersects linkedset query with portal scope so silos / ignore-silos rules are applied in portal.
core/ormlinkset.class.inc.php Optimizes column loading during index generation and changes how preserved items are reloaded during iteration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

{
$sId = key($this->aPreserved);
$oRet = MetaModel::GetObject($this->sClass, $sId);
$oRet = MetaModel::GetObject($this->sClass, $sId, true, true);
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MetaModel::GetObject($this->sClass, $sId, true, true) sets $bAllowAllData=true, which bypasses user-rights filtering for every ormLinkSet iteration. As ormLinkSet is a core structure used outside the portal, this can expose objects/fields a user is not allowed to read. Instead, pass the AllowAllData flag from the original set/search (eg based on $this->oOriginalSet->GetFilter()->IsAllDataAllowed()), so ignoring silos only happens when the underlying query explicitly allows it.

Suggested change
$oRet = MetaModel::GetObject($this->sClass, $sId, true, true);
$bAllowAllData = false;
if ($this->oOriginalSet !== null)
{
$bAllowAllData = $this->oOriginalSet->GetFilter()->IsAllDataAllowed();
}
$oRet = MetaModel::GetObject($this->sClass, $sId, true, $bAllowAllData);

Copilot uses AI. Check for mistakes.
{
$aRet = array();
$this->oOriginalSet->Rewind();
$this->oOriginalSet->OptimizeColumnLoad([$this->sClass => []]);
Copy link

Copilot AI Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OptimizeColumnLoad() expects an array keyed by class alias (see DBObjectSet::OptimizeColumnLoad()), but this uses $this->sClass (class name). If the underlying filter alias was renamed (eg to Link in indirect linkedsets), this optimization won’t apply and the set may still load all columns. Use the original filter’s class alias (eg $this->oOriginalSet->GetFilter()->GetClassAlias()) as the key.

Suggested change
$this->oOriginalSet->OptimizeColumnLoad([$this->sClass => []]);
$oFilter = $this->oOriginalSet->GetFilter();
$sClassAlias = $oFilter->GetClassAlias();
$this->oOriginalSet->OptimizeColumnLoad([$sClassAlias => []]);

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Work made by Combodo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants