bug de page parente avec permission

This commit is contained in:
Fred Tempez 2024-03-29 21:40:55 +01:00
parent fad19249db
commit fc502a1c64

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
$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 if (
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'])) // Page parent
and ($this->getUser('group') * self::MAX_PROFILS + $this->getUser('profil')) >= ($this->getData(['page', $this->$pageId, 'group']) * self::MAX_PROFILS + $this->getData(['page', $pageId, 'profil'])) $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) { 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