Groupe MODERATOR devient EDITOR

This commit is contained in:
Fred Tempez 2023-07-05 18:04:42 +02:00
parent a1096af3de
commit 92c8c0a653
17 changed files with 71 additions and 71 deletions

View File

@ -575,7 +575,7 @@ class layout extends common
and $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') and $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
) or ($this->getData(['page', $parentPageId, 'disable']) === true ) or ($this->getData(['page', $parentPageId, 'disable']) === true
and $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') and $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
and $this->getUser('group') < self::GROUP_MODERATOR and $this->getUser('group') < self::GROUP_EDITOR
) )
) { ) {
$pageUrl = ($this->getData(['locale', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0); $pageUrl = ($this->getData(['locale', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
@ -641,7 +641,7 @@ class layout extends common
and $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') and $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
) or ($this->getData(['page', $childKey, 'disable']) === true ) or ($this->getData(['page', $childKey, 'disable']) === true
and $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') and $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
and $this->getUser('group') < self::GROUP_MODERATOR and $this->getUser('group') < self::GROUP_EDITOR
) )
) { ) {
$pageUrl = ($this->getData(['locale', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0); $pageUrl = ($this->getData(['locale', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
@ -876,7 +876,7 @@ class layout extends common
// Items de gauche // Items de gauche
$leftItems = ''; $leftItems = '';
// Sélecteur de langues // Sélecteur de langues
if ($this->getUser('group') >= self::GROUP_MODERATOR) { if ($this->getUser('group') >= self::GROUP_EDITOR) {
$c = 0; $c = 0;
$leftItem = ''; $leftItem = '';
foreach (self::$languages as $key => $value) { foreach (self::$languages as $key => $value) {
@ -893,7 +893,7 @@ class layout extends common
} }
} }
// Liste des pages // Liste des pages
if ($this->getUser('group') >= self::GROUP_MODERATOR) { if ($this->getUser('group') >= self::GROUP_EDITOR) {
$leftItems .= '<li><select id="barSelectPage">'; $leftItems .= '<li><select id="barSelectPage">';
$leftItems .= '<option value="">' . helper::translate('Pages du site') . '</option>'; $leftItems .= '<option value="">' . helper::translate('Pages du site') . '</option>';
$leftItems .= '<optgroup label="' . helper::translate('Pages orphelines') . '">'; $leftItems .= '<optgroup label="' . helper::translate('Pages orphelines') . '">';
@ -1006,7 +1006,7 @@ class layout extends common
// Items de droite // Items de droite
$rightItems = ''; $rightItems = '';
if ( if (
$this->getUser('group') >= self::GROUP_MODERATOR $this->getUser('group') >= self::GROUP_EDITOR
&& $this->getUser( && $this->getUser(
'permission', 'permission',
'filemanager' 'filemanager'
@ -1066,7 +1066,7 @@ class layout extends common
} }
} }
if ( if (
$this->getUser('group') >= self::GROUP_MODERATOR $this->getUser('group') >= self::GROUP_EDITOR
&& $this->getUser('permission', 'user', 'edit') && $this->getUser('permission', 'user', 'edit')
) { ) {
@ -1153,7 +1153,7 @@ class layout extends common
$vars .= 'var baseUrlQs = ' . json_encode(helper::baseUrl()) . ';'; $vars .= 'var baseUrlQs = ' . json_encode(helper::baseUrl()) . ';';
if ( if (
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
and $this->getUser('group') >= self::GROUP_MODERATOR and $this->getUser('group') >= self::GROUP_EDITOR
) { ) {
$vars .= 'var privateKey = ' . json_encode(md5_file(self::DATA_DIR . 'core.json')) . ';'; $vars .= 'var privateKey = ' . json_encode(md5_file(self::DATA_DIR . 'core.json')) . ';';
} }

View File

@ -541,7 +541,7 @@ class core extends common
and $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD') and $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
) or ($this->getData(['page', $this->getUrl(0), 'disable']) === true ) or ($this->getData(['page', $this->getUrl(0), 'disable']) === true
and $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') and $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
and $this->getUser('group') < self::GROUP_MODERATOR and $this->getUser('group') < self::GROUP_EDITOR
) )
) { ) {
$access = false; $access = false;

View File

@ -27,7 +27,7 @@ class common
const GROUP_BANNED = -1; const GROUP_BANNED = -1;
const GROUP_VISITOR = 0; const GROUP_VISITOR = 0;
const GROUP_MEMBER = 1; const GROUP_MEMBER = 1;
const GROUP_MODERATOR = 2; const GROUP_EDITOR = 2;
const GROUP_ADMIN = 3; const GROUP_ADMIN = 3;
const SIGNATURE_ID = 1; const SIGNATURE_ID = 1;
const SIGNATURE_PSEUDO = 2; const SIGNATURE_PSEUDO = 2;
@ -136,24 +136,24 @@ class common
self::GROUP_BANNED => 'Banni', self::GROUP_BANNED => 'Banni',
self::GROUP_VISITOR => 'Visiteur', self::GROUP_VISITOR => 'Visiteur',
self::GROUP_MEMBER => 'Membre', self::GROUP_MEMBER => 'Membre',
self::GROUP_MODERATOR => 'Éditeur', self::GROUP_EDITOR => 'Éditeur',
self::GROUP_ADMIN => 'Administrateur' self::GROUP_ADMIN => 'Administrateur'
]; ];
public static $groupEdits = [ public static $groupEdits = [
self::GROUP_BANNED => 'Banni', self::GROUP_BANNED => 'Banni',
self::GROUP_MEMBER => 'Membre', self::GROUP_MEMBER => 'Membre',
self::GROUP_MODERATOR => 'Éditeur', self::GROUP_EDITOR => 'Éditeur',
self::GROUP_ADMIN => 'Administrateur' self::GROUP_ADMIN => 'Administrateur'
]; ];
public static $groupNews = [ public static $groupNews = [
self::GROUP_MEMBER => 'Membre', self::GROUP_MEMBER => 'Membre',
self::GROUP_MODERATOR => 'Éditeur', self::GROUP_EDITOR => 'Éditeur',
self::GROUP_ADMIN => 'Administrateur' self::GROUP_ADMIN => 'Administrateur'
]; ];
public static $groupPublics = [ public static $groupPublics = [
self::GROUP_VISITOR => 'Visiteur', self::GROUP_VISITOR => 'Visiteur',
self::GROUP_MEMBER => 'Membre', self::GROUP_MEMBER => 'Membre',
self::GROUP_MODERATOR => 'Éditeur', self::GROUP_EDITOR => 'Éditeur',
self::GROUP_ADMIN => 'Administrateur' self::GROUP_ADMIN => 'Administrateur'
]; ];

View File

@ -390,7 +390,7 @@ class init extends common
] ]
], ],
'2' => [ '2' => [
'name' => 'Membre', 'name' => 'Membre avec droit de partage',
'readonly' => false, 'readonly' => false,
'comment' => 'Accède aux pages réservées et à un dossier partagé', 'comment' => 'Accède aux pages réservées et à un dossier partagé',
'filemanager' => true, 'filemanager' => true,
@ -475,7 +475,7 @@ class init extends common
], ],
'2' => [ '2' => [
'1' => [ '1' => [
'name' => 'Modérateur', 'name' => 'Editeur simple',
'readonly' => false, 'readonly' => false,
'comment' => 'Edition des pages', 'comment' => 'Edition des pages',
'filemanager' => true, 'filemanager' => true,

View File

@ -18,12 +18,12 @@ class page extends common
{ {
public static $actions = [ public static $actions = [
'add' => self::GROUP_MODERATOR, 'add' => self::GROUP_EDITOR,
'delete' => self::GROUP_MODERATOR, 'delete' => self::GROUP_EDITOR,
'edit' => self::GROUP_MODERATOR, 'edit' => self::GROUP_EDITOR,
'duplicate' => self::GROUP_MODERATOR, 'duplicate' => self::GROUP_EDITOR,
'jsEditor' => self::GROUP_MODERATOR, 'jsEditor' => self::GROUP_EDITOR,
'cssEditor' => self::GROUP_MODERATOR 'cssEditor' => self::GROUP_EDITOR
]; ];
public static $pagesNoParentId = [ public static $pagesNoParentId = [
'' => 'Aucune' '' => 'Aucune'

View File

@ -66,7 +66,7 @@ class user extends common
public static $groupProfils = [ public static $groupProfils = [
self::GROUP_MEMBER => 'Membre', self::GROUP_MEMBER => 'Membre',
self::GROUP_MODERATOR => 'Editeur' self::GROUP_EDITOR => 'Editeur'
]; ];
/** /**
@ -191,7 +191,7 @@ class user extends common
// L'utilisateur n'existe pas // L'utilisateur n'existe pas
$this->getData(['user', $this->getUrl(2)]) === null $this->getData(['user', $this->getUrl(2)]) === null
// Groupe insuffisant // Groupe insuffisant
and ($this->getUrl('group') < self::GROUP_MODERATOR) and ($this->getUrl('group') < self::GROUP_EDITOR)
) { ) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
@ -251,7 +251,7 @@ class user extends common
and $this->getUrl('group') <= self::GROUP_VISITOR and $this->getUrl('group') <= self::GROUP_VISITOR
) )
// Impossible d'éditer un autre utilisateur // Impossible d'éditer un autre utilisateur
or ($this->getUrl('group') < self::GROUP_MODERATOR) or ($this->getUrl('group') < self::GROUP_EDITOR)
) )
) { ) {
// Valeurs en sortie // Valeurs en sortie
@ -503,7 +503,7 @@ class user extends common
]; ];
} elseif ( } elseif (
$groupId == self::GROUP_MEMBER || $groupId == self::GROUP_MEMBER ||
$groupId == self::GROUP_MODERATOR $groupId == self::GROUP_EDITOR
) { ) {
// Enumérer les sous groupes MEMBER et MODERATOR // Enumérer les sous groupes MEMBER et MODERATOR
foreach ($groupData as $subGroupId => $subGroupData) { foreach ($groupData as $subGroupId => $subGroupData) {

View File

@ -102,8 +102,8 @@
]); ?> ]); ?>
</div> </div>
<div class="userAddGroupProfil displayNone" <div class="userAddGroupProfil displayNone"
id="userAddGroupProfil<?php echo self::GROUP_MODERATOR; ?>"> id="userAddGroupProfil<?php echo self::GROUP_EDITOR; ?>">
<?php echo template::select('userAddProfil' . self::GROUP_MODERATOR, $module::$userProfils[self::GROUP_MODERATOR], [ <?php echo template::select('userAddProfil' . self::GROUP_EDITOR, $module::$userProfils[self::GROUP_EDITOR], [
'label' => 'Profil', 'label' => 'Profil',
]); ?> ]); ?>
</div> </div>
@ -116,9 +116,9 @@
]); ]);
?> ?>
</div> </div>
<div id="userCommentProfil<?php echo self::GROUP_MODERATOR; ?>" class="col12 displayNone userCommentProfil"> <div id="userCommentProfil<?php echo self::GROUP_EDITOR; ?>" class="col12 displayNone userCommentProfil">
<?php echo template::textarea('useraddProfilComment2' . self::GROUP_MODERATOR, [ <?php echo template::textarea('useraddProfilComment2' . self::GROUP_EDITOR, [
"value" => implode("\n",$module::$userProfilsComments[self::GROUP_MODERATOR]) "value" => implode("\n",$module::$userProfilsComments[self::GROUP_EDITOR])
]); ]);
?> ?>
</div> </div>

View File

@ -123,8 +123,8 @@
]); ?> ]); ?>
</div> </div>
<div class="userEditGroupProfil displayNone" <div class="userEditGroupProfil displayNone"
id="userEditGroupProfil<?php echo self::GROUP_MODERATOR; ?>"> id="userEditGroupProfil<?php echo self::GROUP_EDITOR; ?>">
<?php echo template::select('userEditProfil' . self::GROUP_MODERATOR, $module::$userProfils[self::GROUP_MODERATOR], [ <?php echo template::select('userEditProfil' . self::GROUP_EDITOR, $module::$userProfils[self::GROUP_EDITOR], [
'label' => 'Profil', 'label' => 'Profil',
'selected' => $this->getData(['user', $this->getUrl(2), 'profil']) 'selected' => $this->getData(['user', $this->getUrl(2), 'profil'])
]); ?> ]); ?>
@ -138,9 +138,9 @@
]); ]);
?> ?>
</div> </div>
<div id="userCommentProfil<?php echo self::GROUP_MODERATOR; ?>" class="col12 displayNone userCommentProfil"> <div id="userCommentProfil<?php echo self::GROUP_EDITOR; ?>" class="col12 displayNone userCommentProfil">
<?php echo template::textarea('useraddProfilComment2' . self::GROUP_MODERATOR, [ <?php echo template::textarea('useraddProfilComment2' . self::GROUP_EDITOR, [
"value" => implode("\n",$module::$userProfilsComments[self::GROUP_MODERATOR]) "value" => implode("\n",$module::$userProfilsComments[self::GROUP_EDITOR])
]); ]);
?> ?>
</div> </div>

View File

@ -51,7 +51,7 @@
</div> </div>
</div> </div>
</div> </div>
<?php if ($this->getUrl(2) >= self::GROUP_MODERATOR): ?> <?php if ($this->getUrl(2) >= self::GROUP_EDITOR): ?>
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<div class="block"> <div class="block">

View File

@ -27,15 +27,15 @@ class blog extends common
const EDIT_ALL = 'all'; const EDIT_ALL = 'all';
public static $actions = [ public static $actions = [
'add' => self::GROUP_MODERATOR, 'add' => self::GROUP_EDITOR,
'comment' => self::GROUP_MODERATOR, 'comment' => self::GROUP_EDITOR,
'commentApprove' => self::GROUP_MODERATOR, 'commentApprove' => self::GROUP_EDITOR,
'commentDelete' => self::GROUP_MODERATOR, 'commentDelete' => self::GROUP_EDITOR,
'commentDeleteAll' => self::GROUP_MODERATOR, 'commentDeleteAll' => self::GROUP_EDITOR,
'config' => self::GROUP_MODERATOR, 'config' => self::GROUP_EDITOR,
'option' => self::GROUP_MODERATOR, 'option' => self::GROUP_EDITOR,
'delete' => self::GROUP_MODERATOR, 'delete' => self::GROUP_EDITOR,
'edit' => self::GROUP_MODERATOR, 'edit' => self::GROUP_EDITOR,
'index' => self::GROUP_VISITOR, 'index' => self::GROUP_VISITOR,
'rss' => self::GROUP_VISITOR 'rss' => self::GROUP_VISITOR
]; ];
@ -697,7 +697,7 @@ class blog extends common
ksort(self::$users); ksort(self::$users);
foreach (self::$users as $userId => &$userFirstname) { foreach (self::$users as $userId => &$userFirstname) {
// Les membres ne sont pas éditeurs, les exclure de la liste // Les membres ne sont pas éditeurs, les exclure de la liste
if ($this->getData(['user', $userId, 'group']) < self::GROUP_MODERATOR) { if ($this->getData(['user', $userId, 'group']) < self::GROUP_EDITOR) {
unset(self::$users[$userId]); unset(self::$users[$userId]);
} }
$userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']) . ' (' . self::$groupEdits[$this->getData(['user', $userId, 'group'])] . ')'; $userFirstname = $userFirstname . ' ' . $this->getData(['user', $userId, 'lastname']) . ' (' . self::$groupEdits[$this->getData(['user', $userId, 'group'])] . ')';

View File

@ -29,7 +29,7 @@
or ( or (
// Groupe // Groupe
($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) === self::GROUP_ADMIN ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) === self::GROUP_ADMIN
or $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) === self::GROUP_MODERATOR) or $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) === self::GROUP_EDITOR)
and $this->getUser('group') >= $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) and $this->getUser('group') >= $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent'])
) )
or ( or (

View File

@ -62,7 +62,7 @@
or ( or (
// Groupe // Groupe
($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === self::GROUP_ADMIN ($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === self::GROUP_ADMIN
or $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === self::GROUP_MODERATOR) or $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === self::GROUP_EDITOR)
and $this->getUser('group') >= $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) and $this->getUser('group') >= $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent'])
) )
or ( or (

View File

@ -22,13 +22,13 @@ class form extends common
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json) const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
public static $actions = [ public static $actions = [
'config' => self::GROUP_MODERATOR, 'config' => self::GROUP_EDITOR,
'option' => self::GROUP_MODERATOR, 'option' => self::GROUP_EDITOR,
'data' => self::GROUP_MODERATOR, 'data' => self::GROUP_EDITOR,
'delete' => self::GROUP_MODERATOR, 'delete' => self::GROUP_EDITOR,
'deleteall' => self::GROUP_MODERATOR, 'deleteall' => self::GROUP_EDITOR,
'index' => self::GROUP_VISITOR, 'index' => self::GROUP_VISITOR,
'export2csv' => self::GROUP_MODERATOR, 'export2csv' => self::GROUP_EDITOR,
]; ];
public static $data = []; public static $data = [];

View File

@ -44,15 +44,15 @@ class gallery extends common
public static $config = []; public static $config = [];
public static $actions = [ public static $actions = [
'config' => self::GROUP_MODERATOR, 'config' => self::GROUP_EDITOR,
'delete' => self::GROUP_MODERATOR, 'delete' => self::GROUP_EDITOR,
'dirs' => self::GROUP_MODERATOR, 'dirs' => self::GROUP_EDITOR,
'sortGalleries' => self::GROUP_MODERATOR, 'sortGalleries' => self::GROUP_EDITOR,
'sortPictures' => self::GROUP_MODERATOR, 'sortPictures' => self::GROUP_EDITOR,
'edit' => self::GROUP_MODERATOR, 'edit' => self::GROUP_EDITOR,
'add' => self::GROUP_MODERATOR, 'add' => self::GROUP_EDITOR,
'theme' => self::GROUP_MODERATOR, 'theme' => self::GROUP_EDITOR,
'option' => self::GROUP_MODERATOR, 'option' => self::GROUP_EDITOR,
'index' => self::GROUP_VISITOR 'index' => self::GROUP_VISITOR
]; ];

View File

@ -21,13 +21,13 @@ class news extends common
const DATADIRECTORY = self::DATA_DIR . 'news/'; const DATADIRECTORY = self::DATA_DIR . 'news/';
public static $actions = [ public static $actions = [
'add' => self::GROUP_MODERATOR, 'add' => self::GROUP_EDITOR,
'config' => self::GROUP_MODERATOR, 'config' => self::GROUP_EDITOR,
// Edition des news // Edition des news
'option' => self::GROUP_MODERATOR, 'option' => self::GROUP_EDITOR,
// paramétrage des news // paramétrage des news
'delete' => self::GROUP_MODERATOR, 'delete' => self::GROUP_EDITOR,
'edit' => self::GROUP_MODERATOR, 'edit' => self::GROUP_EDITOR,
'index' => self::GROUP_VISITOR, 'index' => self::GROUP_VISITOR,
'rss' => self::GROUP_VISITOR 'rss' => self::GROUP_VISITOR
]; ];

View File

@ -21,7 +21,7 @@ class redirection extends common
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json) const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
public static $actions = [ public static $actions = [
'config' => self::GROUP_MODERATOR, 'config' => self::GROUP_EDITOR,
'index' => self::GROUP_VISITOR 'index' => self::GROUP_VISITOR
]; ];
@ -60,7 +60,7 @@ class redirection extends common
if ( if (
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true $this->getUser('permission', __CLASS__, __FUNCTION__) !== true
&& $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') && $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
&& $this->getUser('group') >= self::GROUP_MODERATOR && $this->getUser('group') >= self::GROUP_EDITOR
&& $this->getUrl(1) !== 'force' && $this->getUrl(1) !== 'force'
) { ) {
// Valeurs en sortie // Valeurs en sortie

View File

@ -26,7 +26,7 @@ class search extends common
public static $actions = [ public static $actions = [
'index' => self::GROUP_VISITOR, 'index' => self::GROUP_VISITOR,
'config' => self::GROUP_MODERATOR 'config' => self::GROUP_EDITOR
]; ];
// Variables pour l'affichage des résultats // Variables pour l'affichage des résultats