bug de page parente avec permission

This commit is contained in:
Fred Tempez 2024-03-29 21:40:55 +01:00
parent 060aa9e4d5
commit 660398bad7
1 changed files with 59 additions and 59 deletions

View File

@ -706,65 +706,65 @@ class common
* Appelée par le core uniquement * Appelée par le core uniquement
*/ */
private function buildHierarchy() private function buildHierarchy()
{ {
$pages = helper::arrayColumn($this->getData(['page']), 'position', 'SORT_ASC'); $pages = helper::arrayColumn($this->getData(['page']), 'position', 'SORT_ASC');
// Parents // Parents
foreach ($pages as $pageId => $pagePosition) { foreach ($pages as $pageId => $pagePosition) {
if ( if (
// Page parent // Page parent
$this->getData(['page', $pageId, 'parentPageId']) === "" $this->getData(['page', $pageId, 'parentPageId']) === ""
// Ignore les pages dont l'utilisateur n'a pas accès // Ignore les pages dont l'utilisateur n'a pas accès
and ($this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR and ($this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR
or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
//and $this->getUser('group') >= $this->getData(['page', $pageId, 'group']) //and $this->getUser('group') >= $this->getData(['page', $pageId, 'group'])
// Modification qui tient compte du profil de la page // 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'])) 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) { if ($pagePosition !== 0) {
$this->hierarchy['visible'][$pageId] = []; $this->hierarchy['visible'][$pageId] = [];
} }
if ($this->getData(['page', $pageId, 'block']) === 'bar') { if ($this->getData(['page', $pageId, 'block']) === 'bar') {
$this->hierarchy['bar'][$pageId] = []; $this->hierarchy['bar'][$pageId] = [];
} }
$this->hierarchy['all'][$pageId] = []; $this->hierarchy['all'][$pageId] = [];
} }
} }
// Enfants // Enfants
foreach ($pages as $pageId => $pagePosition) { foreach ($pages as $pageId => $pagePosition) {
if (
// Page parent if (
$parentId = $this->getData(['page', $pageId, 'parentPageId']) // Page parent
// Ignore les pages dont l'utilisateur n'a pas accès $parentId = $this->getData(['page', $pageId, 'parentPageId'])
and ( // Ignore les pages dont l'utilisateur n'a pas accès
($this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR and (
and $this->getData(['page', $parentId, 'group']) === self::GROUP_VISITOR (
) $this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR
or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') and
//and $this->getUser('group') >= $this->getData(['page', $parentId, 'group']) $this->getData(['page', $parentId, 'group']) === self::GROUP_VISITOR
//and $this->getUser('group') >= $this->getData(['page', $pageId, 'group']) )
or (
// Modification qui tient compte du profil de la page $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
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
and ($this->getUser('group') * self::MAX_PROFILS + $this->getUser('profil')) >= ($this->getData(['page', $this->$pageId, 'group']) * self::MAX_PROFILS + $this->getData(['page', $pageId, 'profil'])) $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) { if ($pagePosition !== 0) {
$this->hierarchy['visible'][$parentId][] = $pageId; $this->hierarchy['visible'][$parentId][] = $pageId;
} }
if ($this->getData(['page', $pageId, 'block']) === 'bar') { if ($this->getData(['page', $pageId, 'block']) === 'bar') {
$this->hierarchy['bar'][$pageId] = []; $this->hierarchy['bar'][$pageId] = [];
} }
$this->hierarchy['all'][$parentId][] = $pageId; $this->hierarchy['all'][$parentId][] = $pageId;
} }
} }
} }
/** /**
* Génère un fichier json avec la liste des pages * Génère un fichier json avec la liste des pages