"role" pour "group"

This commit is contained in:
Fred Tempez 2025-02-07 12:28:20 +01:00
parent a2bb3a51a7
commit 831d01987d
27 changed files with 167 additions and 167 deletions

View File

@ -353,7 +353,7 @@ class layout extends common
}
// Affichage de la barre de membre simple
if (
$this->getUser('group') >= self::GROUP_MEMBER && $this->getUser('group') < self::GROUP_ADMIN
$this->getUser('role') >= self::GROUP_MEMBER && $this->getUser('role') < self::GROUP_ADMIN
&& $this->getData(['theme', 'footer', 'memberBar']) === true
) {
$items .= '<span id="footerDisplayMemberAccount"';
@ -508,7 +508,7 @@ class layout extends common
* Affichage du sélecteur d'espaces
*/
if (
$this->getUser('group') === self::GROUP_MEMBER
$this->getUser('role') === self::GROUP_MEMBER
&& $this->getData(['theme', 'menu', 'selectSpace']) === true
) {
if ($this->getCoursesByProfil()) {
@ -532,7 +532,7 @@ class layout extends common
&& $this->getData(['course', self::$siteContent, 'enrolment']) >= 1
) {
$href = '';
switch ($this->getUser('group')) {
switch ($this->getUser('role')) {
case self::GROUP_MEMBER:
$href = helper::baseUrl() . 'course/userReport/' . self::$siteContent . '/' . $this->getUser('id');
break;
@ -565,7 +565,7 @@ class layout extends common
* Affichage des boutons gestionnaire de fichiers et mon compte
*/
if (
$this->getUser('group') === self::GROUP_MEMBER
$this->getUser('role') === self::GROUP_MEMBER
&& $this->getData(['theme', 'menu', 'memberBar']) === true
) {
@ -648,7 +648,7 @@ class layout extends common
and $this->isConnected() === false
) or ($this->getData(['page', $parentPageId, 'disable']) === true
and $this->isConnected() === true
and $this->getUser('group') < self::GROUP_EDITOR
and $this->getUser('role') < self::GROUP_EDITOR
)
) {
$pageUrl = ($this->getData(['config', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
@ -714,7 +714,7 @@ class layout extends common
and $this->isConnected() === false
) or ($this->getData(['page', $childKey, 'disable']) === true
and $this->isConnected() === true
and $this->getUser('group') < self::GROUP_EDITOR
and $this->getUser('role') < self::GROUP_EDITOR
)
) {
$pageUrl = ($this->getData(['config', 'homePageId']) === $this->getUrl(0)) ? helper::baseUrl(false) : helper::baseUrl() . $this->getUrl(0);
@ -975,7 +975,7 @@ class layout extends common
* Les admins voient tous les contenus
* Les enseignants les contenus dont ils sont auteurs
*/
if ($this->getUser('group') >= self::GROUP_EDITOR) {
if ($this->getUser('role') >= self::GROUP_EDITOR) {
if (is_array($this->getCoursesByProfil())) {
$leftItems .= '<li><select id="barSelectCourse" >';
$leftItems .= '<option name="' . helper::translate('Accueil') . '" value="' . helper::baseUrl(true) . 'course/swap/home" ' . ('home' === self::$siteContent ? 'selected' : '') . '>' . helper::translate('Accueil') . '</option>';
@ -990,7 +990,7 @@ class layout extends common
'help' => 'Gérer les espaces'
]) . '</li>';
}
if ($this->getUser('group') >= self::GROUP_ADMIN) {
if ($this->getUser('role') >= self::GROUP_ADMIN) {
$leftItems .= '<li>' . template::ico('brush', [
'help' => 'Thème',
'href' => helper::baseUrl() . 'theme'
@ -998,8 +998,8 @@ class layout extends common
}
// Liste des pages et bouton de gestion interdit pour l'accueil sauf admin
if (
($this->getUser('group') === self::GROUP_EDITOR && self::$siteContent != 'home')
|| $this->getUser('group') === self::GROUP_ADMIN
($this->getUser('role') === self::GROUP_EDITOR && self::$siteContent != 'home')
|| $this->getUser('role') === self::GROUP_ADMIN
) {
$leftItems .= '<li><select id="barSelectPage">';
$leftItems .= '<option value="">' . helper::translate('Pages du site') . '</option>';
@ -1122,11 +1122,11 @@ class layout extends common
$rightItems = '';
if (
(
$this->getUser('group') === self::GROUP_EDITOR
$this->getUser('role') === self::GROUP_EDITOR
&& $this->getUser('permission', 'filemanager') === true
&& $this->getUser('permission', 'folder', (self::$siteContent === 'home' ? 'homePath' : 'coursePath')) !== 'none'
)
|| $this->getUser('group') === self::GROUP_ADMIN
|| $this->getUser('role') === self::GROUP_ADMIN
) {
$folder = '&fldr=/' . (self::$siteContent === 'home' ? '' : self::$siteContent);
$rightItems .= '<li>' . template::ico('folder', [
@ -1137,7 +1137,7 @@ class layout extends common
}
if (
self::$siteContent === 'home'
&& $this->getUser('group') >= self::GROUP_ADMIN
&& $this->getUser('role') >= self::GROUP_ADMIN
) {
$rightItems .= '<li>' . template::ico('flag', [
'help' => 'Langues',
@ -1211,7 +1211,7 @@ class layout extends common
}
// Boutons depuis le groupe éditeur
if (
$this->getUser('group') >= self::GROUP_EDITOR
$this->getUser('role') >= self::GROUP_EDITOR
&& $this->getUser('permission', 'user', 'edit')
) {
@ -1297,7 +1297,7 @@ class layout extends common
$vars .= 'var baseUrlQs = ' . json_encode(helper::baseUrl()) . ';';
if (
$this->isConnected() === true
and $this->getUser('group') >= self::GROUP_EDITOR
and $this->getUser('role') >= self::GROUP_EDITOR
) {
$vars .= 'var privateKey = ' . json_encode(md5_file(self::DATA_DIR . 'core.json')) . ';';
}

View File

@ -446,7 +446,7 @@ class core extends common
&& $this->getData(['course', self::$siteContent, 'enrolment']) > 0
// Le userId n'est pas celui d'un admis ni le compte d'un gestionnaire de cet espace
&& (
$this->getUser('group') < common::GROUP_ADMIN
$this->getUser('role') < common::GROUP_ADMIN
|| $this->getUser('id') !== $this->getData(['course', common::$siteContent, 'author'])
)
) {
@ -473,7 +473,7 @@ class core extends common
// Force la déconnexion des membres bannis ou d'une seconde session
if (
$this->isConnected() === true
and ($this->getUser('group') === common::GROUP_BANNED
and ($this->getUser('role') === common::GROUP_BANNED
or ($_SESSION['csrf'] !== $this->getData(['user', $this->getUser('id'), 'accessCsrf'])
and $this->getData(['config', 'connect', 'autoDisconnect']) === true)
)
@ -488,7 +488,7 @@ class core extends common
and $this->getUrl(1) !== 'login'
and ($this->isConnected() === false
or ($this->isConnected() === true
and $this->getUser('group') < common::GROUP_ADMIN
and $this->getUser('role') < common::GROUP_ADMIN
)
)
) {
@ -505,11 +505,11 @@ class core extends common
$access = null;
if ($this->getData(['page', $this->getUrl(0)]) !== null) {
if (
$this->getData(['page', $this->getUrl(0), 'group']) === common::GROUP_VISITOR
$this->getData(['page', $this->getUrl(0), 'role']) === common::GROUP_VISITOR
or ($this->isConnected() === true
// and $this->getUser('group') >= $this->getData(['page', $this->getUrl(0), 'group'])
// and $this->getUser('role') >= $this->getData(['page', $this->getUrl(0), 'role'])
// Modification qui tient compte du profil de la page
and ($this->getUser('group') * 10 + $this->getUser('profil')) >= ($this->getData(['page', $this->getUrl(0), 'group']) * 10 + $this->getData(['page', $this->getUrl(0), 'profil']))
and ($this->getUser('role') * 10 + $this->getUser('profil')) >= ($this->getData(['page', $this->getUrl(0), 'role']) * 10 + $this->getData(['page', $this->getUrl(0), 'profil']))
)
) {
$access = true;
@ -526,7 +526,7 @@ class core extends common
and $this->isConnected() === false
) or ($this->getData(['page', $this->getUrl(0), 'disable']) === true
and $this->isConnected() === true
and $this->getUser('group') < common::GROUP_EDITOR
and $this->getUser('role') < common::GROUP_EDITOR
)
) {
$access = false;
@ -709,7 +709,7 @@ class core extends common
if (
($module::$actions[$action] === common::GROUP_VISITOR
or ($this->isConnected() === true
and $this->getUser('group') >= $module::$actions[$action]
and $this->getUser('role') >= $module::$actions[$action]
and $this->getUser('permission', $moduleId, $action)
)
)

View File

@ -821,11 +821,11 @@ class common
// Page parent
$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', $pageId, 'role']) === self::GROUP_VISITOR
or ($this->getUser('authKey') === $this->getInput('ZWII_AUTH_KEY')
//and $this->getUser('group') >= $this->getData(['page', $pageId, 'group'])
//and $this->getUser('role') >= $this->getData(['page', $pageId, 'role'])
// 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('role') * self::MAX_PROFILS + $this->getUser('profil')) >= ($this->getData(['page', $pageId, 'role']) * self::MAX_PROFILS + $this->getData(['page', $pageId, 'profil']))
)
)
@ -848,14 +848,14 @@ class common
// Ignore les pages dont l'utilisateur n'a pas accès
and (
(
$this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR
$this->getData(['page', $pageId, 'role']) === self::GROUP_VISITOR
and
$this->getData(['page', $parentId, 'group']) === self::GROUP_VISITOR
$this->getData(['page', $parentId, 'role']) === self::GROUP_VISITOR
)
or (
$this->getUser('authKey') === $this->getInput('ZWII_AUTH_KEY')
and
$this->getUser('group') * self::MAX_PROFILS + $this->getUser('profil')) >= ($this->getData(['page', $pageId, 'group']) * self::MAX_PROFILS + $this->getData(['page', $pageId, 'profil'])
$this->getUser('role') * self::MAX_PROFILS + $this->getUser('profil')) >= ($this->getData(['page', $pageId, 'role']) * self::MAX_PROFILS + $this->getData(['page', $pageId, 'profil'])
)
)
@ -1048,33 +1048,33 @@ class common
public function getPermission($key1, $key2 = null)
{
// Administrateur, toutes les permissions
if ($this->getUser('group') === self::GROUP_ADMIN) {
if ($this->getUser('role') === self::GROUP_ADMIN) {
return true;
} elseif ($this->getUser('group') <= self::GROUP_VISITOR) { // Groupe sans autorisation
} elseif ($this->getUser('role') <= self::GROUP_VISITOR) { // Groupe sans autorisation
return false;
} elseif (
// Groupe avec profil, consultation des autorisations sur deux clés
$key1
&& $key2
&& $this->user
&& $this->getData(['profil', $this->user['group'], $this->user['profil'], $key1])
&& array_key_exists($key2, $this->getData(['profil', $this->user['group'], $this->user['profil'], $key1]))
&& $this->getData(['profil', $this->user['role'], $this->user['profil'], $key1])
&& array_key_exists($key2, $this->getData(['profil', $this->user['role'], $this->user['profil'], $key1]))
) {
return $this->getData(['profil', $this->user['group'], $this->user['profil'], $key1, $key2]);
return $this->getData(['profil', $this->user['role'], $this->user['profil'], $key1, $key2]);
// Groupe avec profil, consultation des autorisations sur une seule clé
} elseif (
$key1
&& $this->user
&& $this->getData(['profil', $this->user['group'], $this->user['profil']])
&& array_key_exists($key1, $this->getData(['profil', $this->user['group'], $this->user['profil']]))
&& $this->getData(['profil', $this->user['role'], $this->user['profil']])
&& array_key_exists($key1, $this->getData(['profil', $this->user['role'], $this->user['profil']]))
) {
return $this->getData(['profil', $this->user['group'], $this->user['profil'], $key1]);
return $this->getData(['profil', $this->user['role'], $this->user['profil'], $key1]);
} else {
// Une permission non spécifiée dans le profil est autorisée selon la valeur de $actions
if (class_exists($key1)) {
$module = new $key1;
if (array_key_exists($key2, $module::$actions)) {
return $this->getUser('group') >= $module::$actions[$key2];
return $this->getUser('role') >= $module::$actions[$key2];
}
}
return false;
@ -1169,7 +1169,7 @@ class common
foreach ($this->getHierarchy() as $parentPageId => $childrenPageIds) {
// Exclure les barres et les pages non publiques et les pages masquées
if (
$this->getData(['page', $parentPageId, 'group']) !== 0 ||
$this->getData(['page', $parentPageId, 'role']) !== 0 ||
$this->getData(['page', $parentPageId, 'block']) === 'bar'
) {
continue;
@ -1197,7 +1197,7 @@ class common
}
// Sous-pages
foreach ($childrenPageIds as $childKey) {
if ($this->getData(['page', $childKey, 'group']) !== 0 || $this->getData(['page', $childKey, 'disable']) === true) {
if ($this->getData(['page', $childKey, 'role']) !== 0 || $this->getData(['page', $childKey, 'disable']) === true) {
continue;
}
// Cas de la page d'accueil ne pas dupliquer l'URL
@ -1624,7 +1624,7 @@ function makeThumb($src, $dest, $desired_width)
$courses = $this->getData([('course')]);
$courses = helper::arraycolumn($courses, 'title', 'SORT_ASC');
$filter = array();
switch ($this->getUser('group')) {
switch ($this->getUser('role')) {
case self::GROUP_ADMIN:
// Affiche tout
return $courses;

View File

@ -35,7 +35,7 @@
</head>
<body>
<!-- Barre d'administration -->
<?php if ($this->getUser('group') > self::GROUP_MEMBER) : ?>
<?php if ($this->getUser('role') > self::GROUP_MEMBER) : ?>
<?php $layout->showBar(); ?>
<?php endif; ?>
<!-- Notifications -->
@ -48,7 +48,7 @@
$this->getData(['theme', 'menu', 'position']) === 'top'
and $this->getData(['theme', 'menu', 'fixed']) === true
and $this->isConnected() === true
and $this->getUser('group') > self::GROUP_MEMBER
and $this->getUser('role') > self::GROUP_MEMBER
) {
echo '<nav id="navfixedconnected" >';
} else {

View File

@ -94,7 +94,7 @@ class course extends common
if (
$this->getUser('id')
&& $this->getUser('group')
&& $this->getUser('role')
) {
foreach ($this->getData(['course']) as $courseId => $courseValue) {
/**
@ -156,7 +156,7 @@ class course extends common
// Accès limité aux admins
if (
$this->getUser('group') !== self::GROUP_ADMIN
$this->getUser('role') !== self::GROUP_ADMIN
) {
// Valeurs en sortie
$this->addOutput([
@ -414,7 +414,7 @@ class course extends common
// Accès limité aux admins, à l'auteur ou éditeurs inscrits
if (
$this->getUser('group') !== self::$actions[__FUNCTION__]
$this->getUser('role') !== self::$actions[__FUNCTION__]
) {
// Valeurs en sortie
$this->addOutput([
@ -447,7 +447,7 @@ class course extends common
if (
// Accès limité aux admins
$this->getUser('group') !== self::$actions[__FUNCTION__]
$this->getUser('role') !== self::$actions[__FUNCTION__]
// Le contenu n'existe pas
|| $this->getData(['course', $courseId]) === null
) {
@ -487,7 +487,7 @@ class course extends common
if (
// Accès limité aux admins
$this->getUser('group') !== self::$actions[__FUNCTION__]
$this->getUser('role') !== self::$actions[__FUNCTION__]
) {
// Valeurs en sortie
$this->addOutput([
@ -526,7 +526,7 @@ class course extends common
if (
// Accès limité aux admins
$this->getUser('group') !== self::$actions[__FUNCTION__]
$this->getUser('role') !== self::$actions[__FUNCTION__]
) {
// Valeurs en sortie
$this->addOutput([
@ -557,7 +557,7 @@ class course extends common
{
if (
// Accès limité aux admins
$this->getUser('group') !== self::$actions[__FUNCTION__]
$this->getUser('role') !== self::$actions[__FUNCTION__]
) {
// Valeurs en sortie
$this->addOutput([
@ -592,7 +592,7 @@ class course extends common
if (
// Accès limité aux admins
$this->getUser('group') !== self::$actions[__FUNCTION__]
$this->getUser('role') !== self::$actions[__FUNCTION__]
) {
// Valeurs en sortie
$this->addOutput([
@ -682,14 +682,14 @@ class course extends common
foreach ($users as $userId => $userValue) {
// Compte les rôles valides
if (isset($profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])])) {
$profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])]++;
if (isset($profils[$this->getData(['user', $userId, 'role']) . $this->getData(['user', $userId, 'profil'])])) {
$profils[$this->getData(['user', $userId, 'role']) . $this->getData(['user', $userId, 'profil'])]++;
}
// Filtres
if ($this->isPost()) {
// Groupe et profils
$group = (string) $this->getData(['user', $userId, 'group']);
$group = (string) $this->getData(['user', $userId, 'role']);
$profil = (string) $this->getData(['user', $userId, 'profil']);
$firstName = $this->getData(['user', $userId, 'firstname']);
$lastName = $this->getData(['user', $userId, 'lastname']);
@ -850,8 +850,8 @@ class course extends common
foreach ($users as $userId => $userValue) {
// Compte les rôles
if (isset($profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])])) {
$profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])]++;
if (isset($profils[$this->getData(['user', $userId, 'role']) . $this->getData(['user', $userId, 'profil'])])) {
$profils[$this->getData(['user', $userId, 'role']) . $this->getData(['user', $userId, 'profil'])]++;
}
// Filtres
@ -862,7 +862,7 @@ class course extends common
) {
// Groupe et profils
$group = (string) $this->getData(['user', $userId, 'group']);
$group = (string) $this->getData(['user', $userId, 'role']);
$profil = (string) $this->getData(['user', $userId, 'profil']);
$firstName = $this->getData(['user', $userId, 'firstname']);
$lastName = $this->getData(['user', $userId, 'lastname']);
@ -1013,8 +1013,8 @@ class course extends common
foreach ($users as $userId => $userValue) {
// Compte les rôles
if (isset($profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])])) {
$profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])]++;
if (isset($profils[$this->getData(['user', $userId, 'role']) . $this->getData(['user', $userId, 'profil'])])) {
$profils[$this->getData(['user', $userId, 'role']) . $this->getData(['user', $userId, 'profil'])]++;
}
// Filtres
@ -1025,7 +1025,7 @@ class course extends common
) {
// Groupe et profils
$group = (string) $this->getData(['user', $userId, 'group']);
$group = (string) $this->getData(['user', $userId, 'role']);
$profil = (string) $this->getData(['user', $userId, 'profil']);
$firstName = $this->getData(['user', $userId, 'firstname']);
$lastName = $this->getData(['user', $userId, 'lastname']);
@ -1892,7 +1892,7 @@ class course extends common
) {
// Récupérer le dossier du profil
$userPath = $this->getData(['profil', $this->getuser('group'), $this->getuser('profil'), 'folder', 'path']);
$userPath = $this->getData(['profil', $this->getuser('role'), $this->getuser('profil'), 'folder', 'path']);
$userPath = $userPath === '' ? self::$siteContent : $userPath;
// Fichier avec le bon chemin selon le profil
$zipName = self::FILE_DIR . 'source/' . $userPath . '/' . $this->getInput('courseRestoreFile', null, true);
@ -2003,13 +2003,13 @@ class course extends common
*/
public function permissionControl($function, $courseId)
{
switch ($this->getUser('group')) {
switch ($this->getUser('role')) {
case self::GROUP_ADMIN:
return true;
case self::GROUP_EDITOR:
return (
$this->getUser('permission', __CLASS__, $function)
&& $this->getUser('group') === self::$actions[$function]
&& $this->getUser('role') === self::$actions[$function]
&&
// Permission d'accéder aux espaces dans lesquels le membre auteur
(
@ -2043,7 +2043,7 @@ class course extends common
// Si un utilisateur connecté est admin ou auteur, c'est autorisé
if (
$this->isConnected() === true &&
($this->getUser('group') === self::GROUP_ADMIN ||
($this->getUser('role') === self::GROUP_ADMIN ||
$this->getUser('id') === $this->getData(['course', $courseId, 'author']))
) {
return true;
@ -2150,7 +2150,7 @@ class course extends common
private function courseIsUserEnroled($courseId)
{
$userId = $this->getUser('id');
$group = $userId ? $this->getData(['user', $userId, 'group']) : null;
$group = $userId ? $this->getData(['user', $userId, 'role']) : null;
switch ($group) {
case self::GROUP_ADMIN:
$r = true;

View File

@ -3,7 +3,7 @@
<?php echo template::button('courseUserHistoryBack', [
'class' => 'buttonGrey',
// Le retour est différent selon que c'est un admin ou un tuteur ou l'utilisateur lui-même
'href' => $this->getUser('group') === self::GROUP_MEMBER ? helper::baseUrl(false) : helper::baseUrl() . 'course/users/' . $this->getUrl(2),
'href' => $this->getUser('role') === self::GROUP_MEMBER ? helper::baseUrl(false) : helper::baseUrl() . 'course/users/' . $this->getUrl(2),
'value' => template::ico('left')
]); ?>
</div>
@ -13,7 +13,7 @@
'value' => template::ico('download'),
'help' => 'Exporter rapport',
// Le memebre ne peut pas exporter
'disabled' => $this->getUser('group') === self::GROUP_MEMBER
'disabled' => $this->getUser('role') === self::GROUP_MEMBER
]) ?>
</div>
</div>

View File

@ -135,7 +135,7 @@ class install extends common
[
'firstname' => $userFirstname,
'forgot' => 0,
'group' => self::GROUP_ADMIN,
'role' => self::GROUP_ADMIN,
'profil' => 0,
'lastname' => $userLastname,
'pseudo' => 'Admin',

View File

@ -645,7 +645,7 @@ class init extends common
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 1,
'group' => self::GROUP_VISITOR,
'role' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Accueil',
@ -676,7 +676,7 @@ class init extends common
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 6,
'group' => self::GROUP_VISITOR,
'role' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Contact',
@ -707,7 +707,7 @@ class init extends common
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 0,
'group' => self::GROUP_VISITOR,
'role' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Mentions légales',
@ -739,7 +739,7 @@ class init extends common
'modulePosition' => '',
'parentPageId' => '',
'position' => 0,
'group' => self::GROUP_VISITOR,
'role' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Maintenance en cours',
@ -771,7 +771,7 @@ class init extends common
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 0,
'group' => self::GROUP_VISITOR,
'role' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Erreur 403',
@ -802,7 +802,7 @@ class init extends common
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 0,
'group' => self::GROUP_VISITOR,
'role' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Erreur 404',
@ -938,7 +938,7 @@ class init extends common
'config' => [
'button' => '',
'captcha' => true,
'group' => self::GROUP_ADMIN,
'role' => self::GROUP_ADMIN,
'pageId' => '',
'subject' => ''
],
@ -1065,7 +1065,7 @@ class init extends common
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 1,
'group' => self::GROUP_VISITOR,
'role' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Sommaire',
@ -1096,7 +1096,7 @@ class init extends common
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 1,
'group' => self::GROUP_VISITOR,
'role' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Première page',
@ -1127,7 +1127,7 @@ class init extends common
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 1,
'group' => self::GROUP_VISITOR,
'role' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Seconde page',
@ -1158,7 +1158,7 @@ class init extends common
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 1,
'group' => self::GROUP_VISITOR,
'role' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Troisième page',
@ -1189,7 +1189,7 @@ class init extends common
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 0,
'group' => 0,
'role' => 0,
'profil' => 0,
'targetBlank' => false,
'title' => 'Menu',

View File

@ -180,7 +180,7 @@ class page extends common
'parentPageId' => '',
'modulePosition' => 'bottom',
'position' => 0,
'group' => self::GROUP_VISITOR,
'role' => self::GROUP_VISITOR,
'targetBlank' => false,
'title' => $pageTitle,
'shortTitle' => $pageTitle,
@ -572,7 +572,7 @@ class page extends common
'modulePosition' => $this->getInput('pageModulePosition'),
'parentPageId' => $this->getInput('pageEditParentPageId'),
'position' => $position,
'group' => $group,
'role' => $group,
'profil' => $profil,
'targetBlank' => $this->getInput('pageEditTargetBlank', helper::FILTER_BOOLEAN),
'title' => $this->getInput('pageEditTitle', helper::FILTER_STRING_SHORT),

View File

@ -29,7 +29,7 @@ class sitemap extends common
$items = '<ul>';
foreach ($this->getHierarchy(null, true, null) as $parentId => $childIds) {
$items .= ' <li>';
if ($this->getData(['page', $parentId, 'disable']) === false && $this->getUser('group') >= $this->getData(['page', $parentId, 'group'])) {
if ($this->getData(['page', $parentId, 'disable']) === false && $this->getUser('role') >= $this->getData(['page', $parentId, 'role'])) {
$pageUrl = ($parentId !== $this->homePageId()) ? helper::baseUrl() . $parentId : helper::baseUrl(false);
$items .= '<a href="' . $pageUrl . '">' . $this->getData(['page', $parentId, 'title']) . '</a>';
} else {
@ -66,7 +66,7 @@ class sitemap extends common
$items .= '<ul>';
// Sous-page
$items .= ' <li>';
if ($this->getData(['page', $childId, 'disable']) === false && $this->getUser('group') >= $this->getData(['page', $parentId, 'group'])) {
if ($this->getData(['page', $childId, 'disable']) === false && $this->getUser('role') >= $this->getData(['page', $parentId, 'role'])) {
$pageUrl = ($childId !== $this->homePageId()) ? helper::baseUrl() . $childId : helper::baseUrl(false);
$items .= '<a href="' . $pageUrl . '">' . $this->getData(['page', $childId, 'title']) . '</a>';
} else {

View File

@ -124,7 +124,7 @@ class user extends common
[
'firstname' => $userFirstname,
'forgot' => 0,
'group' => $group,
'role' => $group,
'profil' => $profil,
'lastname' => $userLastname,
'pseudo' => $pseudo,
@ -209,7 +209,7 @@ class user extends common
// L'utilisateur n'existe pas
$this->getData(['user', $this->getUrl(2)]) === null
// Groupe insuffisant
and ($this->getUrl('group') < self::GROUP_EDITOR)
and ($this->getUrl('role') < self::GROUP_EDITOR)
) {
// Valeurs en sortie
$this->addOutput([
@ -324,8 +324,8 @@ class user extends common
foreach ($users as $userId => $userValue) {
// Compte les rôles
if (isset($profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])])) {
$profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])]++;
if (isset($profils[$this->getData(['user', $userId, 'role']) . $this->getData(['user', $userId, 'profil'])])) {
$profils[$this->getData(['user', $userId, 'role']) . $this->getData(['user', $userId, 'profil'])]++;
}
// Filtres
@ -336,7 +336,7 @@ class user extends common
) {
// Groupe et profils
$group = (string) $this->getData(['user', $userId, 'group']);
$group = (string) $this->getData(['user', $userId, 'role']);
$profil = (string) $this->getData(['user', $userId, 'profil']);
$firstName = $this->getData(['user', $userId, 'firstname']);
$lastName = $this->getData(['user', $userId, 'lastname']);
@ -411,10 +411,10 @@ class user extends common
and (
// Impossible de s'auto-éditer
($this->getUser('id') === $this->getUrl(2)
and $this->getUrl('group') <= self::GROUP_VISITOR
and $this->getUrl('role') <= self::GROUP_VISITOR
)
// Impossible d'éditer un autre utilisateur
or ($this->getUrl('group') < self::GROUP_EDITOR)
or ($this->getUrl('role') < self::GROUP_EDITOR)
)
) {
// Valeurs en sortie
@ -430,7 +430,7 @@ class user extends common
) {
$oldPassword = $this->getData(['user', $this->getUrl(2), 'password']);
// Double vérification pour le mot de passe
if ($this->getUser('group') < self::GROUP_ADMIN) {
if ($this->getUser('role') < self::GROUP_ADMIN) {
if ($this->getInput('userEditNewPassword')) {
// L'ancien mot de passe est correct
if (
@ -467,15 +467,15 @@ class user extends common
// Modification du groupe
if (
$this->getUser('group') === self::GROUP_ADMIN
$this->getUser('role') === self::GROUP_ADMIN
and $this->getUrl(2) !== $this->getUser('id')
) {
$newGroup = $this->getInput('userEditGroup', helper::FILTER_INT, true);
} else {
$newGroup = $this->getData(['user', $this->getUrl(2), 'group']);
$newGroup = $this->getData(['user', $this->getUrl(2), 'role']);
}
// Modification de nom Prénom
if ($this->getUser('group') === self::GROUP_ADMIN) {
if ($this->getUser('role') === self::GROUP_ADMIN) {
$newfirstname = $this->getInput('userEditFirstname', helper::FILTER_STRING_SHORT, true);
$newlastname = $this->getInput('userEditLastname', helper::FILTER_STRING_SHORT, true);
} else {
@ -494,7 +494,7 @@ class user extends common
[
'firstname' => $newfirstname,
'forgot' => 0,
'group' => $newGroup,
'role' => $newGroup,
'profil' => $profil,
'lastname' => $newlastname,
'pseudo' => $this->getInput('userEditPseudo', helper::FILTER_STRING_SHORT, true),
@ -517,7 +517,7 @@ class user extends common
$redirect = helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl());
}
// Redirection si retour en arrière possible
elseif ($this->getUser('group') === self::GROUP_ADMIN) {
elseif ($this->getUser('role') === self::GROUP_ADMIN) {
$redirect = helper::baseUrl() . 'user';
}
// Redirection normale
@ -647,17 +647,17 @@ class user extends common
$userIdsLastNames = helper::arrayColumn($this->getData(['user']), 'lastname');
ksort($userIdsLastNames);
foreach ($userIdsLastNames as $userId => $userLastNames) {
if ($this->getData(['user', $userId, 'group'])) {
if ($this->getData(['user', $userId, 'role'])) {
// Compte les rôles
if (isset($profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])])) {
$profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])]++;
if (isset($profils[$this->getData(['user', $userId, 'role']) . $this->getData(['user', $userId, 'profil'])])) {
$profils[$this->getData(['user', $userId, 'role']) . $this->getData(['user', $userId, 'profil'])]++;
}
// Filtres
if ($this->isPost()) {
// Groupe et profils
$group = (string) $this->getData(['user', $userId, 'group']);
$group = (string) $this->getData(['user', $userId, 'role']);
$profil = (string) $this->getData(['user', $userId, 'profil']);
$firstName = $this->getData(['user', $userId, 'firstname']);
$lastName = $this->getData(['user', $userId, 'lastname']);
@ -684,10 +684,10 @@ class user extends common
self::$users[] = [
//$userId,
sprintf('%s %s',$userLastNames, $this->getData(['user', $userId, 'firstname'])),
helper::translate(self::$groups[(int) $this->getData(['user', $userId, 'group'])]),
empty($this->getData(['profil', $this->getData(['user', $userId, 'group']), $this->getData(['user', $userId, 'profil']), 'name']))
? helper::translate(self::$groups[(int) $this->getData(['user', $userId, 'group'])])
: $this->getData(['profil', $this->getData(['user', $userId, 'group']), $this->getData(['user', $userId, 'profil']), 'name']),
helper::translate(self::$groups[(int) $this->getData(['user', $userId, 'role'])]),
empty($this->getData(['profil', $this->getData(['user', $userId, 'role']), $this->getData(['user', $userId, 'profil']), 'name']))
? helper::translate(self::$groups[(int) $this->getData(['user', $userId, 'role'])])
: $this->getData(['profil', $this->getData(['user', $userId, 'role']), $this->getData(['user', $userId, 'profil']), 'name']),
$this->getData(['user', $userId, 'tags']),
is_null($this->getData(['user', $userId, 'accessTimer']))
? 'Jamais'
@ -737,7 +737,7 @@ class user extends common
// Ne pas supprimer un profil utililsé
// recherche les membres du groupe
$groups = helper::arrayColumn($this->getData(['user']), 'group');
$groups = helper::arrayColumn($this->getData(['user']), 'role');
$groups = array_keys($groups, $this->getUrl(2));
$profilUsed = true;
// Stoppe si le profil est affecté
@ -1201,7 +1201,7 @@ class user extends common
{
// Ne pas supprimer un profil utililsé
// recherche les membres du groupe
$groups = helper::arrayColumn($this->getData(['user']), 'group');
$groups = helper::arrayColumn($this->getData(['user']), 'role');
$groups = array_keys($groups, $this->getUrl(2));
$flag = true;
// Stoppe si le profil est affecté
@ -1308,7 +1308,7 @@ class user extends common
($this->getData(['user', $userId, 'connectTimeout']) + $this->getData(['config', 'connect', 'timeout'])) < time()
and $this->getData(['user', $userId, 'connectFail']) < $this->getData(['config', 'connect', 'attempt'])
and password_verify(html_entity_decode($this->getInput('userLoginPassword', helper::FILTER_STRING_SHORT, true)), $this->getData(['user', $userId, 'password']))
and $this->getData(['user', $userId, 'group']) >= self::GROUP_MEMBER
and $this->getData(['user', $userId, 'role']) >= self::GROUP_MEMBER
and $captcha === true
) {
@ -1322,7 +1322,7 @@ class user extends common
// Valeurs en sortie lorsque le site est en maintenance et que l'utilisateur n'est pas administrateur
if (
$this->getData(['config', 'maintenance'])
and $this->getData(['user', $userId, 'group']) < self::GROUP_ADMIN
and $this->getData(['user', $userId, 'role']) < self::GROUP_ADMIN
) {
$this->addOutput([
'notification' => helper::translate('Seul un administrateur peut se connecter lors d\'une maintenance'),
@ -1342,7 +1342,7 @@ class user extends common
$authRedirect = '';
if (
$this->getData(['config', 'connect', 'mailAuth']) > 0
&& $this->getData(['user', $userId, 'group']) >= $this->getData(['config', 'connect', 'mailAuth'])
&& $this->getData(['user', $userId, 'role']) >= $this->getData(['config', 'connect', 'mailAuth'])
) {
/**
* Envoi d'un email contenant une clé
@ -1691,9 +1691,9 @@ class user extends common
$item['nom'],
$item['prenom'],
self::$groups[$item['groupe']],
empty($this->getData(['profil', $this->getData(['user', $userId, 'group']), $this->getData(['user', $userId, 'profil']), 'name']))
? helper::translate(self::$groups[(int) $this->getData(['user', $userId, 'group'])])
: $this->getData(['profil', $this->getData(['user', $userId, 'group']), $this->getData(['user', $userId, 'profil']), 'name']),
empty($this->getData(['profil', $this->getData(['user', $userId, 'role']), $this->getData(['user', $userId, 'profil']), 'name']))
? helper::translate(self::$groups[(int) $this->getData(['user', $userId, 'role'])])
: $this->getData(['profil', $this->getData(['user', $userId, 'role']), $this->getData(['user', $userId, 'profil']), 'name']),
$item['prenom'],
helper::filter($item['email'], helper::FILTER_MAIL),
$item['tags'],
@ -1709,7 +1709,7 @@ class user extends common
[
'firstname' => $item['prenom'],
'forgot' => 0,
'group' => $item['groupe'],
'role' => $item['groupe'],
'profil' => $item['profil'],
'lastname' => $item['nom'],
'mail' => $item['email'],
@ -1754,9 +1754,9 @@ class user extends common
$item['nom'],
$item['prenom'],
self::$groups[$item['groupe']],
empty($this->getData(['profil', $this->getData(['user', $userId, 'group']), $this->getData(['user', $userId, 'profil']), 'name']))
? helper::translate(self::$groups[(int) $this->getData(['user', $userId, 'group'])])
: $this->getData(['profil', $this->getData(['user', $userId, 'group']), $this->getData(['user', $userId, 'profil']), 'name']),
empty($this->getData(['profil', $this->getData(['user', $userId, 'role']), $this->getData(['user', $userId, 'profil']), 'name']))
? helper::translate(self::$groups[(int) $this->getData(['user', $userId, 'role'])])
: $this->getData(['profil', $this->getData(['user', $userId, 'role']), $this->getData(['user', $userId, 'profil']), 'name']),
$item['prenom'],
$item['email'],
$item['tags'],
@ -1890,8 +1890,8 @@ class user extends common
foreach ($users as $userId => $userValue) {
// Compte les rôles
if (isset($profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])])) {
$profils[$this->getData(['user', $userId, 'group']) . $this->getData(['user', $userId, 'profil'])]++;
if (isset($profils[$this->getData(['user', $userId, 'role']) . $this->getData(['user', $userId, 'profil'])])) {
$profils[$this->getData(['user', $userId, 'role']) . $this->getData(['user', $userId, 'profil'])]++;
}
// Filtres
@ -1902,7 +1902,7 @@ class user extends common
) {
// Groupe et profils
$group = (string) $this->getData(['user', $userId, 'group']);
$group = (string) $this->getData(['user', $userId, 'role']);
$profil = (string) $this->getData(['user', $userId, 'profil']);
$firstName = $this->getData(['user', $userId, 'firstname']);
$lastName = $this->getData(['user', $userId, 'lastname']);

View File

@ -1,7 +1,7 @@
<?php echo template::formOpen('userEditForm'); ?>
<div class="row">
<div class="col1">
<?php if ($this->getUser('group') === self::GROUP_ADMIN): ?>
<?php if ($this->getUser('role') === self::GROUP_ADMIN): ?>
<?php echo template::button('userEditBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'user',
@ -29,7 +29,7 @@
<div class="col6">
<?php echo template::text('userEditFirstname', [
'autocomplete' => 'off',
'disabled' => $this->getUser('group') > self::GROUP_EDITOR ? false : true,
'disabled' => $this->getUser('role') > self::GROUP_EDITOR ? false : true,
'label' => 'Prénom',
'value' => $this->getData(['user', $this->getUrl(2), 'firstname'])
]); ?>
@ -37,7 +37,7 @@
<div class="col6">
<?php echo template::text('userEditLastname', [
'autocomplete' => 'off',
'disabled' => $this->getUser('group') > self::GROUP_EDITOR ? false : true,
'disabled' => $this->getUser('role') > self::GROUP_EDITOR ? false : true,
'label' => 'Nom',
'value' => $this->getData(['user', $this->getUrl(2), 'lastname'])
]); ?>
@ -77,7 +77,7 @@
<div class="col12">
<?php echo template::text('userEditTags', [
'label' => 'Étiquettes',
'readonly' => $this->getUser('group') > self::GROUP_EDITOR ? false : true,
'readonly' => $this->getUser('role') > self::GROUP_EDITOR ? false : true,
'value' => $this->getData(['user', $this->getUrl(2), 'tags']),
'help' => 'Les étiquettes sont séparées par des espaces'
]); ?>
@ -99,7 +99,7 @@
]); ?>
<?php
// Les admins ont le pouvoir de forcer le changement de mot de passe
if ($this->getUser('group') < self::GROUP_ADMIN): ?>
if ($this->getUser('role') < self::GROUP_ADMIN): ?>
<?php echo template::password('userEditOldPassword', [
'autocomplete' => 'new-password',
// remplace 'off' pour éviter le pré remplissage auto
@ -125,7 +125,7 @@
</h4>
<div class="row">
<div class="col12">
<?php if ($this->getUser('group') === self::GROUP_ADMIN): ?>
<?php if ($this->getUser('role') === self::GROUP_ADMIN): ?>
<?php echo template::select('userEditGroup', self::$groupEdits, [
'disabled' => ($this->getUrl(2) === $this->getUser('id')),
'help' => ($this->getUrl(2) === $this->getUser('id') ? 'Impossible de modifier votre propre rôle.' : ''),
@ -134,7 +134,7 @@
]); ?>
<?php else: ?>
<?php echo template::hidden('userEditGroup', [
'value' => $this->getData(['user', $this->getUrl(2), 'group'])
'value' => $this->getData(['user', $this->getUrl(2), 'role'])
]); ?>
<?php endif; ?>
</div>
@ -143,14 +143,14 @@
<?php echo template::select('userEditProfil' . self::GROUP_MEMBER, user::$userProfils[self::GROUP_MEMBER], [
'label' => 'Profil',
'selected' => $this->getData(['user', $this->getUrl(2), 'profil']),
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN,
'disabled' => $this->getUser('role') !== self::GROUP_ADMIN,
]); ?>
</div>
<div class="userEditGroupProfil" id="userEditGroupProfil<?php echo self::GROUP_EDITOR; ?>">
<?php echo template::select('userEditProfil' . self::GROUP_EDITOR, user::$userProfils[self::GROUP_EDITOR], [
'label' => 'Profil',
'selected' => $this->getData(['user', $this->getUrl(2), 'profil']),
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN,
'disabled' => $this->getUser('role') !== self::GROUP_ADMIN,
]); ?>
</div>
</div>

View File

@ -25,7 +25,7 @@ $g = json_decode(file_get_contents('../../../site/data/profil.json'), true);
// Lecture les droits
if (!is_null($u) && !is_null($g) && !is_null($userId)) {
$group = $u['user'][$userId]['group'];
$group = $u['user'][$userId]['role'];
switch ($group) {
case 3:
// Accès admin

View File

@ -23,7 +23,7 @@ class blog extends common
const DATADIRECTORY = ''; // Contenu localisé inclus par défaut (page.json et module.json)
const EDIT_OWNER = 'owner';
const EDIT_GROUP = 'group';
const EDIT_GROUP = 'role';
const EDIT_ALL = 'all';
public static $actions = [
@ -259,7 +259,7 @@ class blog extends common
$this->isPost()
) {
// Modification de l'userId
if ($this->getUser('group') === self::GROUP_ADMIN) {
if ($this->getUser('role') === self::GROUP_ADMIN) {
$newuserid = $this->getInput('blogAddUserId', helper::FILTER_STRING_SHORT, true);
} else {
$newuserid = $this->getUser('id');
@ -284,7 +284,7 @@ class blog extends common
'state' => $this->getInput('blogAddState', helper::FILTER_BOOLEAN),
'title' => $this->getInput('blogAddTitle', helper::FILTER_STRING_SHORT, true),
'userId' => $newuserid,
'editConsent' => $this->getInput('blogAddConsent') === self::EDIT_GROUP ? $this->getUser('group') : $this->getInput('blogAddConsent'),
'editConsent' => $this->getInput('blogAddConsent') === self::EDIT_GROUP ? $this->getUser('role') : $this->getInput('blogAddConsent'),
'commentMaxlength' => $this->getInput('blogAddCommentMaxlength'),
'commentApproved' => $this->getInput('blogAddCommentApproved', helper::FILTER_BOOLEAN),
'commentClose' => $this->getInput('blogAddCommentClose', helper::FILTER_BOOLEAN),
@ -493,13 +493,13 @@ class blog extends common
( // Propriétaire
$this->getData(['module', $this->getUrl(0), 'posts', $value, 'editConsent']) === self::EDIT_OWNER
and ($this->getData(['module', $this->getUrl(0), 'posts', $value, 'userId']) === $this->getUser('id')
or $this->getUser('group') === self::GROUP_ADMIN)
or $this->getUser('role') === self::GROUP_ADMIN)
)
or (
// Groupe
$this->getData(['module', $this->getUrl(0), 'posts', $value, 'editConsent']) !== self::EDIT_OWNER
and $this->getUser('group') >= $this->getData(['module', $this->getUrl(0), 'posts', $value, 'editConsent'])
and $this->getUser('role') >= $this->getData(['module', $this->getUrl(0), 'posts', $value, 'editConsent'])
)
or (
// Tout le monde
@ -655,7 +655,7 @@ class blog extends common
$this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
$this->isPost()
) {
if ($this->getUser('group') === self::GROUP_ADMIN) {
if ($this->getUser('role') === self::GROUP_ADMIN) {
$newuserid = $this->getInput('blogEditUserId', helper::FILTER_STRING_SHORT, true);
} else {
$newuserid = $this->getUser('id');
@ -683,7 +683,7 @@ class blog extends common
'publishedOn' => $this->getInput('blogEditPublishedOn', helper::FILTER_DATETIME, true),
'state' => $this->getInput('blogEditState', helper::FILTER_BOOLEAN),
'userId' => $newuserid,
'editConsent' => $this->getInput('blogEditConsent') === self::EDIT_GROUP ? $this->getUser('group') : $this->getInput('blogEditConsent'),
'editConsent' => $this->getInput('blogEditConsent') === self::EDIT_GROUP ? $this->getUser('role') : $this->getInput('blogEditConsent'),
'commentMaxlength' => $this->getInput('blogEditCommentMaxlength'),
'commentApproved' => $this->getInput('blogEditCommentApproved', helper::FILTER_BOOLEAN),
'commentClose' => $this->getInput('blogEditCommentClose', helper::FILTER_BOOLEAN),
@ -707,10 +707,10 @@ class blog extends common
ksort(self::$users);
foreach (self::$users as $userId => &$userFirstname) {
// 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, 'role']) < self::GROUP_EDITOR) {
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, 'role'])] . ')';
}
unset($userFirstname);
// Valeurs en sortie
@ -783,7 +783,7 @@ class blog extends common
$to = [];
// Liste des destinataires
foreach ($this->getData(['user']) as $userId => $user) {
if ($user['group'] >= $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentGroupNotification'])) {
if ($user['role'] >= $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'commentGroupNotification'])) {
$to[] = $user['mail'];
$firstname[] = $user['firstname'];
$lastname[] = $user['lastname'];

View File

@ -82,7 +82,7 @@
<?php echo template::select('blogAddUserId', blog::$users, [
'label' => 'Auteur',
'selected' => $this->getUser('id'),
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN ? true : false
'disabled' => $this->getUser('role') !== self::GROUP_ADMIN ? true : false
]); ?>
</div>
<div class="col4">

View File

@ -52,18 +52,18 @@
( // Propriétaire
($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) === blog::EDIT_OWNER
and ($this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'userId']) === $this->getUser('id')
or $this->getUser('group') === self::GROUP_ADMIN)
or $this->getUser('role') === self::GROUP_ADMIN)
)
or (
// Groupe
($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_EDITOR)
and $this->getUser('group') >= $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent'])
and $this->getUser('role') >= $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent'])
)
or (
// Tout le monde
$this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'editConsent']) === blog::EDIT_ALL
and $this->getUser('group') >= blog::$actions['config']
and $this->getUser('role') >= blog::$actions['config']
)
)
): ?>

View File

@ -89,7 +89,7 @@
<?php echo template::select('blogEditUserId', blog::$users, [
'label' => 'Auteur',
'selected' => $this->getUser('id'),
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN ? true : false
'disabled' => $this->getUser('role') !== self::GROUP_ADMIN ? true : false
]); ?>
</div>
<div class="col4">

View File

@ -77,18 +77,18 @@
( // Propriétaire
($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === blog::EDIT_OWNER
and ($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'userId']) === $this->getUser('id')
or $this->getUser('group') === self::GROUP_ADMIN)
or $this->getUser('role') === self::GROUP_ADMIN)
)
or (
// Groupe
($this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === self::GROUP_ADMIN
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('role') >= $this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent'])
)
or (
// Tout le monde
$this->getData(['module', $this->getUrl(0), 'posts', $articleId, 'editConsent']) === blog::EDIT_ALL
and $this->getUser('group') >= blog::$actions['config']
and $this->getUser('role') >= blog::$actions['config']
)
)
): ?>

View File

@ -185,7 +185,7 @@ class form extends common
[
'button' => $this->getInput('formOptionButton'),
'captcha' => $this->getInput('formOptionCaptcha', helper::FILTER_BOOLEAN),
'group' => $this->getInput('formOptionGroup', helper::FILTER_INT),
'role' => $this->getInput('formOptionGroup', helper::FILTER_INT),
'user' => self::$listUsers[$this->getInput('formOptionUser', helper::FILTER_INT)],
'mail' => $this->getInput('formOptionMail'),
'pageId' => $this->getInput('formOptionPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formOptionPageId', helper::FILTER_ID) : '',
@ -454,7 +454,7 @@ class form extends common
'mail'
]);
$singlemail = $this->getData(['module', $this->getUrl(0), 'config', 'mail']);
$group = $this->getData(['module', $this->getUrl(0), 'config', 'group']);
$group = $this->getData(['module', $this->getUrl(0), 'config', 'role']);
// Verification si le mail peut être envoyé
if (
self::$inputNotices === [] && (
@ -466,7 +466,7 @@ class form extends common
$to = [];
if ($group > 0) {
foreach ($this->getData(['user']) as $userId => $user) {
if ($user['group'] >= $group) {
if ($user['role'] >= $group) {
$to[] = $user['mail'];
}
}

View File

@ -3,7 +3,7 @@ class init extends form {
public static $defaultData = [
'button'=> '',
'captcha'=> false,
'group'=> 0,
'role'=> 0,
'user'=> '',
'mail'=> '',
'pageId'=> '',

View File

@ -80,7 +80,7 @@
<div class="block">
<h4><?php echo helper::translate('Courriel'); ?></h4>
<?php echo template::checkbox('formOptionMailOptionsToggle', true, 'Envoyer par mail les données saisies :', [
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'group']) ||
'checked' => (bool) $this->getData(['module', $this->getUrl(0), 'config', 'role']) ||
!empty($this->getData(['module', $this->getUrl(0), 'config', 'user'])) ||
!empty($this->getData(['module', $this->getUrl(0), 'config', 'mail'])),
'help' => 'Sélectionnez au moins un groupe, un utilisateur ou saisissez un email. Votre serveur doit autoriser les envois de mail.'
@ -103,7 +103,7 @@
<div class="col4">
<?php echo template::select('formOptionGroup', $groupMembers, [
'label' => 'A tous les rôles depuis',
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'group']),
'selected' => $this->getData(['module', $this->getUrl(0), 'config', 'role']),
]); ?>
</div>
<div class="col4">

View File

@ -42,7 +42,7 @@
$this->isConnected() === true
and
( // Propriétaire
($this->getUser('group') === self::GROUP_ADMIN)
($this->getUser('role') === self::GROUP_ADMIN)
)
): ?>
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1); ?>">

View File

@ -52,7 +52,7 @@
$this->isConnected() === true
and
( // Propriétaire
($this->getUser('group') === self::GROUP_ADMIN)
($this->getUser('role') === self::GROUP_ADMIN)
)
): ?>
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $newsId; ?>">

View File

@ -59,7 +59,7 @@ class redirection extends common
// Message si l'utilisateur peut éditer la page
if (
$this->isConnected() === true
&& $this->getUser('group') >= self::GROUP_EDITOR
&& $this->getUser('role') >= self::GROUP_EDITOR
&& $this->getUrl(1) !== 'force'
) {
// Valeurs en sortie

View File

@ -208,7 +208,7 @@ class search extends common
foreach ($this->getHierarchy(null, false, null) as $parentId => $childIds) {
if (
$this->getData(['page', $parentId, 'disable']) === false &&
$this->getUser('group') >= $this->getData(['page', $parentId, 'group']) &&
$this->getUser('role') >= $this->getData(['page', $parentId, 'role']) &&
$this->getData(['page', $parentId, 'block']) !== 'bar'
) {
$url = $parentId;
@ -227,7 +227,7 @@ class search extends common
// Sous page
if (
$this->getData(['page', $childId, 'disable']) === false &&
$this->getUser('group') >= $this->getData(['page', $parentId, 'group']) &&
$this->getUser('role') >= $this->getData(['page', $parentId, 'role']) &&
$this->getData(['page', $parentId, 'block']) !== 'bar'
) {
$url = $childId;

View File

@ -113,10 +113,10 @@ class suscribe extends common
// Impossible de s'auto-éditer
(
$this->getUser('id') === 'user'
and $this->getUrl('group') <= self::GROUP_VISITOR
and $this->getUrl('role') <= self::GROUP_VISITOR
)
// Impossible d'éditer un autre utilisateur
or ($this->getUrl('group') < self::GROUP_EDITOR)
or ($this->getUrl('role') < self::GROUP_EDITOR)
)
) {
// Valeurs en sortie
@ -138,7 +138,7 @@ class suscribe extends common
[
'firstname' => $this->getData(['module', $this->getUrl(0), 'users', $this->getUrl(2), 'firstname']),
'forgot' => 0,
'group' => $this->getInput('registrationUserEditGroup', helper::FILTER_INT),
'role' => $this->getInput('registrationUserEditGroup', helper::FILTER_INT),
// Le profil vaut 0 pour les amdins et 1 pour les autres membres, profil par défaut.
'profil' => $this->getInput('registrationUserEditGroup', helper::FILTER_INT) === self::GROUP_ADMIN
? 0 : 1,
@ -314,7 +314,7 @@ class suscribe extends common
// Utilisateurs dans le groupe admin
$to = [];
foreach ($this->getData(['user']) as $key => $user) {
if ($user['group'] == self::GROUP_ADMIN) {
if ($user['role'] == self::GROUP_ADMIN) {
$to[] = $user['mail'];
}
}
@ -418,7 +418,7 @@ class suscribe extends common
'lastname' => $this->getData(['module', $this->getUrl(0), 'users', $userId, 'lastname']),
'mail' => $this->getData(['module', $this->getUrl(0), 'users', $userId, 'mail']),
'password' => $this->getInput('registrationValidPassword', helper::FILTER_PASSWORD, true),
'group' => self::GROUP_MEMBER,
'role' => self::GROUP_MEMBER,
'profil' => 1,
'forgot' => 0,
'pseudo' => $userId,

View File

@ -25,7 +25,7 @@
]); ?>
</div>
<div class="col4">
<?php if ($this->getUser('group') === self::GROUP_ADMIN): ?>
<?php if ($this->getUser('role') === self::GROUP_ADMIN): ?>
<?php echo template::select('registrationUserEditGroup', suscribe::$groups, [
'disabled' => ($this->getUrl(2) === $this->getUser('id')),
'help' => ($this->getUrl(2) === $this->getUser('id') ? 'Impossible de modifier votre propre role.' : ''),
@ -40,7 +40,7 @@
<?php echo template::select('registrationUserEditProfil' . self::GROUP_MEMBER, suscribe::$userProfils[self::GROUP_MEMBER], [
'label' => 'Profil',
'selected' => $this->getData(['user', $this->getUrl(2), 'profil']),
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN,
'disabled' => $this->getUser('role') !== self::GROUP_ADMIN,
]); ?>
</div>
<div class="registrationUserEditGroupProfil"
@ -48,7 +48,7 @@
<?php echo template::select('registrationUserEditProfil' . self::GROUP_EDITOR, suscribe::$userProfils[self::GROUP_EDITOR], [
'label' => 'Profil',
'selected' => $this->getData(['user', $this->getUrl(2), 'profil']),
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN,
'disabled' => $this->getUser('role') !== self::GROUP_ADMIN,
]); ?>
</div>
</div>