EDITOR devient MODERATOR

This commit is contained in:
Fred Tempez 2020-10-14 19:17:13 +02:00
parent f9eb28f6f3
commit d4321076fc
12 changed files with 47 additions and 47 deletions

View File

@ -23,7 +23,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_EDITOR = 2; const GROUP_MODERATOR = 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;
@ -127,24 +127,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_EDITOR => 'Éditeur', self::GROUP_MODERATOR => 'É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_EDITOR => 'Éditeur', self::GROUP_MODERATOR => 'É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_EDITOR => 'Éditeur', self::GROUP_MODERATOR => 'É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_EDITOR => 'Éditeur', self::GROUP_MODERATOR => 'Éditeur',
self::GROUP_ADMIN => 'Administrateur' self::GROUP_ADMIN => 'Administrateur'
]; ];
public static $timezone; public static $timezone;
@ -2695,7 +2695,7 @@ class layout extends common {
if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')) { if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')) {
// Items de gauche // Items de gauche
$leftItems = ''; $leftItems = '';
if($this->getUser('group') >= self::GROUP_EDITOR) { if($this->getUser('group') >= self::GROUP_MODERATOR) {
$leftItems .= '<li><select id="barSelectPage">'; $leftItems .= '<li><select id="barSelectPage">';
$leftItems .= '<option value="">Choisissez une page</option>'; $leftItems .= '<option value="">Choisissez une page</option>';
$leftItems .= '<optgroup label="Pages orphelines">'; $leftItems .= '<optgroup label="Pages orphelines">';
@ -2759,7 +2759,7 @@ class layout extends common {
} }
// Items de droite // Items de droite
$rightItems = ''; $rightItems = '';
if($this->getUser('group') >= self::GROUP_EDITOR) { if($this->getUser('group') >= self::GROUP_MODERATOR) {
$rightItems .= '<li><a href="' . helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR.'core.json') .'" data-tippy-content="Gérer les fichiers" data-lity>' . template::ico('folder') . '</a></li>'; $rightItems .= '<li><a href="' . helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR.'core.json') .'" data-tippy-content="Gérer les fichiers" data-lity>' . template::ico('folder') . '</a></li>';
} }
if($this->getUser('group') >= self::GROUP_ADMIN) { if($this->getUser('group') >= self::GROUP_ADMIN) {
@ -2818,7 +2818,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_EDITOR AND $this->getUser('group') >= self::GROUP_MODERATOR
) { ) {
$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

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

View File

@ -124,7 +124,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_EDITOR) AND ($this->getUrl('group') < self::GROUP_MODERATOR)
) { ) {
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
@ -183,7 +183,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_EDITOR) OR ($this->getUrl('group') < self::GROUP_MODERATOR)
) )
) { ) {
// Valeurs en sortie // Valeurs en sortie

View File

@ -50,7 +50,7 @@
<ul id="userAddGroupDescription<?php echo self::GROUP_MEMBER; ?>" class="userAddGroupDescription displayNone"> <ul id="userAddGroupDescription<?php echo self::GROUP_MEMBER; ?>" class="userAddGroupDescription displayNone">
<li>Accès aux pages privées membres</li> <li>Accès aux pages privées membres</li>
</ul> </ul>
<ul id="userAddGroupDescription<?php echo self::GROUP_EDITOR; ?>" class="userAddGroupDescription displayNone"> <ul id="userAddGroupDescription<?php echo self::GROUP_MODERATOR; ?>" class="userAddGroupDescription displayNone">
<li>Accès aux pages privées membres et éditeurs</li> <li>Accès aux pages privées membres et éditeurs</li>
<li>Ajout / Édition / Suppression de pages</li> <li>Ajout / Édition / Suppression de pages</li>
<li>Ajout / Édition / Suppression de fichiers</li> <li>Ajout / Édition / Suppression de fichiers</li>

View File

@ -68,7 +68,7 @@
<ul id="userEditGroupDescription<?php echo self::GROUP_MEMBER; ?>" class="userEditGroupDescription displayNone"> <ul id="userEditGroupDescription<?php echo self::GROUP_MEMBER; ?>" class="userEditGroupDescription displayNone">
<li>Accès aux pages privées membres</li> <li>Accès aux pages privées membres</li>
</ul> </ul>
<ul id="userEditGroupDescription<?php echo self::GROUP_EDITOR; ?>" class="userEditGroupDescription displayNone"> <ul id="userEditGroupDescription<?php echo self::GROUP_MODERATOR; ?>" class="userEditGroupDescription displayNone">
<li>Accès aux pages privées membres et éditeurs</li> <li>Accès aux pages privées membres et éditeurs</li>
<li>Ajout / Édition / Suppression de pages</li> <li>Ajout / Édition / Suppression de pages</li>
<li>Ajout / Édition / Suppression de fichiers</li> <li>Ajout / Édition / Suppression de fichiers</li>

View File

@ -19,14 +19,14 @@ class blog extends common {
const EDIT_ALL = 'all'; const EDIT_ALL = 'all';
public static $actions = [ public static $actions = [
'add' => self::GROUP_EDITOR, 'add' => self::GROUP_MODERATOR,
'comment' => self::GROUP_EDITOR, 'comment' => self::GROUP_MODERATOR,
'commentApprove' => self::GROUP_EDITOR, 'commentApprove' => self::GROUP_MODERATOR,
'commentDelete' => self::GROUP_EDITOR, 'commentDelete' => self::GROUP_MODERATOR,
'commentDeleteAll' => self::GROUP_EDITOR, 'commentDeleteAll' => self::GROUP_MODERATOR,
'config' => self::GROUP_EDITOR, 'config' => self::GROUP_MODERATOR,
'delete' => self::GROUP_EDITOR, 'delete' => self::GROUP_MODERATOR,
'edit' => self::GROUP_EDITOR, 'edit' => self::GROUP_MODERATOR,
'index' => self::GROUP_VISITOR 'index' => self::GROUP_VISITOR
]; ];
@ -310,7 +310,7 @@ class blog extends common {
( (
$this->getData(['module', $this->getUrl(0), $value,'editConsent']) === self::EDIT_OWNER $this->getData(['module', $this->getUrl(0), $value,'editConsent']) === self::EDIT_OWNER
AND $this->getData(['module', $this->getUrl(0), $value,'userId']) === $this->getUser('id') AND $this->getData(['module', $this->getUrl(0), $value,'userId']) === $this->getUser('id')
AND $this->getUser('group') >= self::GROUP_EDITOR AND $this->getUser('group') >= self::GROUP_MODERATOR
) )
OR ( OR (
@ -481,7 +481,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_EDITOR) { if ( $this->getData(['user', $userId, 'group']) < self::GROUP_MODERATOR) {
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

@ -15,7 +15,7 @@
( (
$this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER
AND $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'userId']) === $this->getUser('id') AND $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'userId']) === $this->getUser('id')
AND $this->getUser('group') >= self::GROUP_EDITOR AND $this->getUser('group') >= self::GROUP_MODERATOR
) )
) OR ( ) OR (
// Groupe // Groupe

View File

@ -17,13 +17,13 @@
class form extends common { class form extends common {
public static $actions = [ public static $actions = [
'config' => self::GROUP_EDITOR, 'config' => self::GROUP_MODERATOR,
'data' => self::GROUP_EDITOR, 'data' => self::GROUP_MODERATOR,
'delete' => self::GROUP_EDITOR, 'delete' => self::GROUP_MODERATOR,
'deleteall' => self::GROUP_EDITOR, 'deleteall' => self::GROUP_MODERATOR,
'index' => self::GROUP_VISITOR, 'index' => self::GROUP_VISITOR,
'export2csv' => self::GROUP_EDITOR, 'export2csv' => self::GROUP_MODERATOR,
'output2csv' => self::GROUP_EDITOR 'output2csv' => self::GROUP_MODERATOR
]; ];
public static $data = []; public static $data = [];

View File

@ -36,13 +36,13 @@ class gallery extends common {
public static $thumbs = []; public static $thumbs = [];
public static $actions = [ public static $actions = [
'config' => self::GROUP_EDITOR, 'config' => self::GROUP_MODERATOR,
'delete' => self::GROUP_EDITOR, 'delete' => self::GROUP_MODERATOR,
'dirs' => self::GROUP_EDITOR, 'dirs' => self::GROUP_MODERATOR,
'sortGalleries' => self::GROUP_EDITOR, 'sortGalleries' => self::GROUP_MODERATOR,
'sortPictures' => self::GROUP_EDITOR, 'sortPictures' => self::GROUP_MODERATOR,
'edit' => self::GROUP_EDITOR, 'edit' => self::GROUP_MODERATOR,
'theme' => self::GROUP_EDITOR, 'theme' => self::GROUP_MODERATOR,
'index' => self::GROUP_VISITOR 'index' => self::GROUP_VISITOR
]; ];

View File

@ -15,10 +15,10 @@
class news extends common { class news extends common {
public static $actions = [ public static $actions = [
'add' => self::GROUP_EDITOR, 'add' => self::GROUP_MODERATOR,
'config' => self::GROUP_EDITOR, 'config' => self::GROUP_MODERATOR,
'delete' => self::GROUP_EDITOR, 'delete' => self::GROUP_MODERATOR,
'edit' => self::GROUP_EDITOR, 'edit' => self::GROUP_MODERATOR,
'index' => self::GROUP_VISITOR 'index' => self::GROUP_VISITOR
]; ];

View File

@ -15,7 +15,7 @@
class redirection extends common { class redirection extends common {
public static $actions = [ public static $actions = [
'config' => self::GROUP_EDITOR, 'config' => self::GROUP_MODERATOR,
'index' => self::GROUP_VISITOR 'index' => self::GROUP_VISITOR
]; ];
@ -49,7 +49,7 @@ class redirection extends common {
// Message si l'utilisateur peut éditer la page // Message si l'utilisateur peut éditer la page
if( if(
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
AND $this->getUser('group') >= self::GROUP_EDITOR AND $this->getUser('group') >= self::GROUP_MODERATOR
AND $this->getUrl(1) !== 'force' AND $this->getUrl(1) !== 'force'
) { ) {
// Valeurs en sortie // Valeurs en sortie

View File

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