From fc502a1c647a26127fc4234b02102936272f33da Mon Sep 17 00:00:00 2001 From: fredtempez Date: Fri, 29 Mar 2024 21:40:55 +0100 Subject: [PATCH] bug de page parente avec permission --- core/core.php | 118 +++++++++++++++++++++++++------------------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/core/core.php b/core/core.php index f9c969b7..f37460d8 100644 --- a/core/core.php +++ b/core/core.php @@ -706,65 +706,65 @@ class common * Appelée par le core uniquement */ - private function buildHierarchy() - { - - $pages = helper::arrayColumn($this->getData(['page']), 'position', 'SORT_ASC'); - // Parents - foreach ($pages as $pageId => $pagePosition) { - if ( - // Page parent - $this->getData(['page', $pageId, 'parentPageId']) === "" - // Ignore les pages dont l'utilisateur n'a pas accès - and ($this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR - or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') - //and $this->getUser('group') >= $this->getData(['page', $pageId, 'group']) - // Modification qui tient compte du profil de la page - and ($this->getUser('group') * self::MAX_PROFILS + $this->getUser('profil')) >= ($this->getData(['page', $pageId, 'group']) * self::MAX_PROFILS + $this->getData(['page', $pageId, 'profil'])) - - ) - ) - ) { - if ($pagePosition !== 0) { - $this->hierarchy['visible'][$pageId] = []; - } - if ($this->getData(['page', $pageId, 'block']) === 'bar') { - $this->hierarchy['bar'][$pageId] = []; - } - $this->hierarchy['all'][$pageId] = []; - } - } - // Enfants - foreach ($pages as $pageId => $pagePosition) { - if ( - // Page parent - $parentId = $this->getData(['page', $pageId, 'parentPageId']) - // Ignore les pages dont l'utilisateur n'a pas accès - and ( - ($this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR - and $this->getData(['page', $parentId, 'group']) === self::GROUP_VISITOR - ) - or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') - //and $this->getUser('group') >= $this->getData(['page', $parentId, 'group']) - //and $this->getUser('group') >= $this->getData(['page', $pageId, 'group']) - - // Modification qui tient compte du profil de la page - and ($this->getUser('group') * self::MAX_PROFILS + $this->getUser('profil')) >= ($this->getData(['page', $this->$parentId, 'group']) * self::MAX_PROFILS + $this->getData(['page', $this->$parentId, 'profil'])) - and ($this->getUser('group') * self::MAX_PROFILS + $this->getUser('profil')) >= ($this->getData(['page', $this->$pageId, 'group']) * self::MAX_PROFILS + $this->getData(['page', $pageId, 'profil'])) - - ) - ) - ) { - if ($pagePosition !== 0) { - $this->hierarchy['visible'][$parentId][] = $pageId; - } - if ($this->getData(['page', $pageId, 'block']) === 'bar') { - $this->hierarchy['bar'][$pageId] = []; - } - $this->hierarchy['all'][$parentId][] = $pageId; - } - } - } + private function buildHierarchy() + { + + $pages = helper::arrayColumn($this->getData(['page']), 'position', 'SORT_ASC'); + // Parents + foreach ($pages as $pageId => $pagePosition) { + if ( + // Page parent + $this->getData(['page', $pageId, 'parentPageId']) === "" + // Ignore les pages dont l'utilisateur n'a pas accès + and ($this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR + or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') + //and $this->getUser('group') >= $this->getData(['page', $pageId, 'group']) + // Modification qui tient compte du profil de la page + and ($this->getUser('group') * self::MAX_PROFILS + $this->getUser('profil')) >= ($this->getData(['page', $pageId, 'group']) * self::MAX_PROFILS + $this->getData(['page', $pageId, 'profil'])) + + ) + ) + ) { + if ($pagePosition !== 0) { + $this->hierarchy['visible'][$pageId] = []; + } + if ($this->getData(['page', $pageId, 'block']) === 'bar') { + $this->hierarchy['bar'][$pageId] = []; + } + $this->hierarchy['all'][$pageId] = []; + } + } + // Enfants + foreach ($pages as $pageId => $pagePosition) { + + if ( + // Page parent + $parentId = $this->getData(['page', $pageId, 'parentPageId']) + // Ignore les pages dont l'utilisateur n'a pas accès + and ( + ( + $this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR + and + $this->getData(['page', $parentId, 'group']) === self::GROUP_VISITOR + ) + or ( + $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') + and + $this->getUser('group') * self::MAX_PROFILS + $this->getUser('profil')) >= ($this->getData(['page', $pageId, 'group']) * self::MAX_PROFILS + $this->getData(['page', $pageId, 'profil']) + + ) + ) + ) { + if ($pagePosition !== 0) { + $this->hierarchy['visible'][$parentId][] = $pageId; + } + if ($this->getData(['page', $pageId, 'block']) === 'bar') { + $this->hierarchy['bar'][$pageId] = []; + } + $this->hierarchy['all'][$parentId][] = $pageId; + } + } + } /** * Génère un fichier json avec la liste des pages