Skip to content
Snippets Groups Projects
Commit 327bac3d authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms Committed by Marcus Eibrink-Lunzenauer
Browse files

check all valid include paths, fixes #2003

Closes #2003

Merge request studip/studip!1302
parent f7a14699
No related branches found
No related tags found
No related merge requests found
...@@ -70,6 +70,25 @@ abstract class SchemaProvider extends BaseSchema ...@@ -70,6 +70,25 @@ abstract class SchemaProvider extends BaseSchema
{ {
$path = $context->getPosition()->getLevel() ? $context->getPosition()->getPath() . '.' : ''; $path = $context->getPosition()->getLevel() ? $context->getPosition()->getPath() . '.' : '';
return in_array($path . $key, $context->getIncludePaths()); return in_array($path . $key, $this->getAllowedAncludePaths($context));
}
/**
* @param ContextInterface $context
* @return array
*/
public function getAllowedAncludePaths(ContextInterface $context): array
{
$allowedIncludePaths = [];
foreach ($context->getIncludePaths() as $path) {
$carry = '';
foreach (explode('.', $path) as $p) {
$allowedIncludePaths[] = $carry . $p;
$carry .= "{$p}.";
}
}
return $allowedIncludePaths;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment