forked from ZwiiCMS-Team/ZwiiCMS
bug de page parente avec permission
This commit is contained in:
parent
fad19249db
commit
fc502a1c64
118
core/core.php
118
core/core.php
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user