Renomme les groupes

This commit is contained in:
Fred Tempez 2023-09-21 21:19:39 +02:00
parent 727f8123c0
commit 2c12067131
21 changed files with 70 additions and 70 deletions

View File

@ -345,7 +345,7 @@ class layout extends common
}
// Affichage de la barre de membre simple
if (
$this->getUser('group') >= self::GROUP_TUTOR && $this->getUser('group') < self::GROUP_ADMIN
$this->getUser('group') >= self::GROUP_STUDENT && $this->getUser('group') < self::GROUP_ADMIN
&& $this->getData(['theme', 'footer', 'memberBar']) === true
) {
$items .= '<span id="footerDisplayMemberAccount"';
@ -506,11 +506,11 @@ class layout extends common
}
// Commandes pour les membres simples
if (
$this->getUser('group') >= self::GROUP_TUTOR && $this->getUser('group') < self::GROUP_ADMIN
$this->getUser('group') >= self::GROUP_STUDENT && $this->getUser('group') < self::GROUP_ADMIN
&& $this->getData(['theme', 'menu', 'memberBar']) === true
) {
if (
$this->getUser('group') >= self::GROUP_TUTOR &&
$this->getUser('group') >= self::GROUP_STUDENT &&
$this->getUser('permission', 'filemanager') === true
) {
$itemsRight .= '<li>' . template::ico('folder', [

View File

@ -527,7 +527,7 @@ class core extends common
$access = null;
if ($this->getData(['page', $this->getUrl(0)]) !== null) {
if (
$this->getData(['page', $this->getUrl(0), 'group']) === self::GROUP_STUDENT
$this->getData(['page', $this->getUrl(0), 'group']) === self::GROUP_VISITOR
or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
// and $this->getUser('group') >= $this->getData(['page', $this->getUrl(0), 'group'])
// Modification qui tient compte du profil de la page
@ -705,7 +705,7 @@ class core extends common
$output = $module->output;
// Check le groupe de l'utilisateur
if (
($module::$actions[$action] === self::GROUP_STUDENT
($module::$actions[$action] === self::GROUP_VISITOR
or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
and $this->getUser('group') >= $module::$actions[$action]
and $this->getUser('permission', $moduleId, $action)

View File

@ -25,8 +25,8 @@ class common
const DISPLAY_LAYOUT_MAIN = 4;
const DISPLAY_LAYOUT_LIGHT = 5;
const GROUP_BANNED = -1;
const GROUP_STUDENT = 0;
const GROUP_TUTOR = 1;
const GROUP_VISITOR = 0;
const GROUP_STUDENT = 1;
const GROUP_TEACHER = 2;
// Groupe MODERATOR, compatibilité avec les anciens modules :
const GROUP_ADMIN = 3;
@ -145,25 +145,25 @@ class common
];
public static $groups = [
self::GROUP_BANNED => 'Banni',
self::GROUP_STUDENT => 'Apprenant',
self::GROUP_TUTOR => 'Tuteur',
self::GROUP_VISITOR => 'Visiteur',
self::GROUP_STUDENT => 'Etudiant',
self::GROUP_TEACHER => 'Enseignant',
self::GROUP_ADMIN => 'Administrateur'
];
public static $groupEdits = [
self::GROUP_BANNED => 'Banni',
self::GROUP_TUTOR => 'Tuteur',
self::GROUP_STUDENT => 'Etudiant',
self::GROUP_TEACHER => 'Enseignant',
self::GROUP_ADMIN => 'Administrateur'
];
public static $groupNews = [
self::GROUP_TUTOR => 'Tuteur',
self::GROUP_STUDENT => 'Etudiant',
self::GROUP_TEACHER => 'Enseignant',
self::GROUP_ADMIN => 'Administrateur'
];
public static $groupPublics = [
self::GROUP_STUDENT => 'Apprenant',
self::GROUP_TUTOR => 'Tuteur',
self::GROUP_VISITOR => 'Visiteur',
self::GROUP_STUDENT => 'Etudiant',
self::GROUP_TEACHER => 'Enseignant',
self::GROUP_ADMIN => 'Administrateur'
];
@ -711,7 +711,7 @@ 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_STUDENT
and ($this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR
or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
//and $this->getUser('group') >= $this->getData(['page', $pageId, 'group'])
// Modification qui tient compte du profil de la page
@ -736,8 +736,8 @@ class common
$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_STUDENT
and $this->getData(['page', $parentId, 'group']) === self::GROUP_STUDENT
($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'])
@ -1435,8 +1435,8 @@ class common
}
}
return $c;
case self::GROUP_TUTOR:
case self::GROUP_STUDENT:
case self::GROUP_VISITOR:
foreach ($c as $courseId => $value) {
$students = $this->getData(['enrolment', $courseId, 'students']);
if (in_array($userId, $students) === false) {
@ -1465,13 +1465,13 @@ class common
case self::GROUP_TEACHER:
$r = in_array($userId, array_keys($this->getData(['enrolment', $courseId])));
break;
case self::GROUP_TUTOR:
case self::GROUP_STUDENT:
$r = $this->courseIsAvailable($courseId) &&
(in_array($userId, array_keys($this->getData(['enrolment', $courseId]))) ||
$this->getData(['course', $courseId, 'enrolment']) <= self::COURSE_ENROLMENT_SELF);
break;
// Visiteur non connecté
case self::GROUP_VISITOR:
case false:
$r = $this->courseIsAvailable($courseId) &&
$this->getData(['course', $courseId, 'enrolment']) === self::COURSE_ENROLMENT_GUEST;

View File

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

View File

@ -21,8 +21,8 @@ class course extends common
'edit' => self::GROUP_ADMIN,
'add' => self::GROUP_ADMIN,
'delete' => self::GROUP_ADMIN,
'swap' => self::GROUP_STUDENT,
'change' => self::GROUP_STUDENT,
'swap' => self::GROUP_VISITOR,
'change' => self::GROUP_VISITOR,
];
public static $courseAccess = [

View File

@ -18,8 +18,8 @@ class install extends common
{
public static $actions = [
'index' => self::GROUP_STUDENT,
"postinstall" => self::GROUP_STUDENT,
'index' => self::GROUP_VISITOR,
"postinstall" => self::GROUP_VISITOR,
'steps' => self::GROUP_ADMIN,
'update' => self::GROUP_ADMIN
];

View File

@ -323,7 +323,7 @@ class init extends common
'comment' => 'Accès désactivé',
],
'0' => [
'name' => 'Apprenant',
'name' => 'Visiteur',
'readonly' => true,
'permanent' => true,
'comment' => 'Accède au site',
@ -687,7 +687,7 @@ class init extends common
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 1,
'group' => self::GROUP_STUDENT,
'group' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Accueil',
@ -718,7 +718,7 @@ class init extends common
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 6,
'group' => self::GROUP_STUDENT,
'group' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Contact',
@ -749,7 +749,7 @@ class init extends common
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 0,
'group' => self::GROUP_STUDENT,
'group' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Mentions légales',
@ -781,7 +781,7 @@ class init extends common
'modulePosition' => '',
'parentPageId' => '',
'position' => 0,
'group' => self::GROUP_STUDENT,
'group' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Maintenance en cours',
@ -813,7 +813,7 @@ class init extends common
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 0,
'group' => self::GROUP_STUDENT,
'group' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Erreur 403',
@ -844,7 +844,7 @@ class init extends common
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 0,
'group' => self::GROUP_STUDENT,
'group' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Erreur 404',
@ -989,7 +989,7 @@ class init extends common
'modulePosition' => 'bottom',
'parentPageId' => '',
'position' => 1,
'group' => self::GROUP_STUDENT,
'group' => self::GROUP_VISITOR,
'profil' => 0,
'targetBlank' => false,
'title' => 'Accueil',

View File

@ -17,7 +17,7 @@ class maintenance extends common
{
public static $actions = [
'index' => self::GROUP_STUDENT
'index' => self::GROUP_VISITOR
];
/**

View File

@ -155,7 +155,7 @@ class page extends common
'parentPageId' => '',
'modulePosition' => 'bottom',
'position' => 0,
'group' => self::GROUP_STUDENT,
'group' => self::GROUP_VISITOR,
'targetBlank' => false,
'title' => $pageTitle,
'shortTitle' => $pageTitle,
@ -564,7 +564,7 @@ class page extends common
// Profils installés
// Profils disponibles
foreach ($this->getData(['profil']) as $profilId => $profilData) {
if ($profilId < self::GROUP_TUTOR) {
if ($profilId < self::GROUP_STUDENT) {
continue;
}
if ($profilId === self::GROUP_ADMIN) {

View File

@ -389,8 +389,8 @@
</div>
<div class="col6">
<div class="pageEditGroupProfil displayNone"
id="pageEditGroupProfil<?php echo self::GROUP_TUTOR; ?>">
<?php echo template::select('pageEditProfil' . self::GROUP_TUTOR, $module::$userProfils[self::GROUP_TUTOR], [
id="pageEditGroupProfil<?php echo self::GROUP_STUDENT; ?>">
<?php echo template::select('pageEditProfil' . self::GROUP_STUDENT, $module::$userProfils[self::GROUP_STUDENT], [
'label' => 'Profil minimal pour accéder à la page',
'selected' => $this->getData(['page', $this->getUrl(2), 'profil']),
'help' => 'Les profils de niveau supérieur accèdent à la page.',

View File

@ -16,7 +16,7 @@
class sitemap extends common
{
public static $actions = [
'index' => self::GROUP_STUDENT
'index' => self::GROUP_VISITOR
];
public static $siteMap = '';

View File

@ -22,11 +22,11 @@ class user extends common
'import' => self::GROUP_ADMIN,
'index' => self::GROUP_ADMIN,
'template' => self::GROUP_ADMIN,
'edit' => self::GROUP_TUTOR,
'logout' => self::GROUP_TUTOR,
'forgot' => self::GROUP_STUDENT,
'login' => self::GROUP_STUDENT,
'reset' => self::GROUP_STUDENT,
'edit' => self::GROUP_STUDENT,
'logout' => self::GROUP_STUDENT,
'forgot' => self::GROUP_VISITOR,
'login' => self::GROUP_VISITOR,
'reset' => self::GROUP_VISITOR,
'profil' => self::GROUP_ADMIN,
'profilEdit' => self::GROUP_ADMIN,
'profilAdd' => self::GROUP_ADMIN,
@ -65,7 +65,7 @@ class user extends common
];
public static $groupProfils = [
self::GROUP_TUTOR => 'Membre',
self::GROUP_STUDENT => 'Membre',
self::GROUP_TEACHER => 'Éditeur'
];
@ -162,7 +162,7 @@ class user extends common
// Profils disponibles
foreach ($this->getData(['profil']) as $profilId => $profilData) {
if ($profilId < self::GROUP_TUTOR) {
if ($profilId < self::GROUP_STUDENT) {
continue;
}
if ($profilId === self::GROUP_ADMIN) {
@ -242,7 +242,7 @@ class user extends common
and (
// Impossible de s'auto-éditer
($this->getUser('id') === $this->getUrl(2)
and $this->getUrl('group') <= self::GROUP_STUDENT
and $this->getUrl('group') <= self::GROUP_VISITOR
)
// Impossible d'éditer un autre utilisateur
or ($this->getUrl('group') < self::GROUP_TEACHER)
@ -354,7 +354,7 @@ class user extends common
// Profils disponibles
foreach ($this->getData(['profil']) as $profilId => $profilData) {
if ($profilId < self::GROUP_TUTOR) {
if ($profilId < self::GROUP_STUDENT) {
continue;
}
if ($profilId === self::GROUP_ADMIN) {
@ -473,7 +473,7 @@ class user extends common
// Membres sans permissions spécifiques
if (
$groupId == self::GROUP_BANNED ||
$groupId == self::GROUP_STUDENT ||
$groupId == self::GROUP_VISITOR ||
$groupId == self::GROUP_ADMIN
) {
self::$userGroups[$groupId] = [
@ -492,7 +492,7 @@ class user extends common
])
];
} elseif (
$groupId == self::GROUP_TUTOR ||
$groupId == self::GROUP_STUDENT ||
$groupId == self::GROUP_TEACHER
) {
// Enumérer les sous groupes MEMBER et MODERATOR
@ -871,7 +871,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_TUTOR
and $this->getData(['user', $userId, 'group']) >= self::GROUP_STUDENT
and $captcha === true
) {
// RAZ

View File

@ -91,13 +91,13 @@
<div class="col6">
<?php echo template::select('userAddGroup', self::$groupNews, [
'label' => 'Groupe',
'selected' => self::GROUP_TUTOR
'selected' => self::GROUP_STUDENT
]); ?>
</div>
<div class="col6">
<div class="userAddGroupProfil displayNone"
id="userAddGroupProfil<?php echo self::GROUP_TUTOR; ?>">
<?php echo template::select('userAddProfil' . self::GROUP_TUTOR, $module::$userProfils[self::GROUP_TUTOR], [
id="userAddGroupProfil<?php echo self::GROUP_STUDENT; ?>">
<?php echo template::select('userAddProfil' . self::GROUP_STUDENT, $module::$userProfils[self::GROUP_STUDENT], [
'label' => 'Profil',
]); ?>
</div>
@ -110,9 +110,9 @@
</div>
</div>
<div class="row">
<div id="userCommentProfil<?php echo self::GROUP_TUTOR; ?>" class="col12 displayNone userCommentProfil">
<?php echo template::textarea('useraddProfilComment' . self::GROUP_TUTOR, [
"value" => implode("\n",$module::$userProfilsComments[self::GROUP_TUTOR])
<div id="userCommentProfil<?php echo self::GROUP_STUDENT; ?>" class="col12 displayNone userCommentProfil">
<?php echo template::textarea('useraddProfilComment' . self::GROUP_STUDENT, [
"value" => implode("\n",$module::$userProfilsComments[self::GROUP_STUDENT])
]);
?>
</div>

View File

@ -116,8 +116,8 @@
</div>
<div class="col6">
<div class="userEditGroupProfil displayNone"
id="userEditGroupProfil<?php echo self::GROUP_TUTOR; ?>">
<?php echo template::select('userEditProfil' . self::GROUP_TUTOR, $module::$userProfils[self::GROUP_TUTOR], [
id="userEditGroupProfil<?php echo self::GROUP_STUDENT; ?>">
<?php echo template::select('userEditProfil' . self::GROUP_STUDENT, $module::$userProfils[self::GROUP_STUDENT], [
'label' => 'Profil',
'selected' => $this->getData(['user', $this->getUrl(2), 'profil']),
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN,
@ -135,10 +135,10 @@
</div>
<div class="row">
<div class="col12">
<div id="userCommentProfil<?php echo self::GROUP_TUTOR; ?>"
<div id="userCommentProfil<?php echo self::GROUP_STUDENT; ?>"
class="col12 userCommentProfil">
<?php echo template::textarea('userEditProfilComment' . self::GROUP_TUTOR, [
"value" => implode("\n", $module::$userProfilsComments[self::GROUP_TUTOR]),
<?php echo template::textarea('userEditProfilComment' . self::GROUP_STUDENT, [
"value" => implode("\n", $module::$userProfilsComments[self::GROUP_STUDENT]),
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN,
]);
?>

View File

@ -36,8 +36,8 @@ class blog extends common
'option' => self::GROUP_TEACHER,
'delete' => self::GROUP_TEACHER,
'edit' => self::GROUP_TEACHER,
'index' => self::GROUP_STUDENT,
'rss' => self::GROUP_STUDENT
'index' => self::GROUP_VISITOR,
'rss' => self::GROUP_VISITOR
];
public static $articles = [];

View File

@ -27,7 +27,7 @@ class form extends common
'data' => self::GROUP_TEACHER,
'delete' => self::GROUP_TEACHER,
'deleteall' => self::GROUP_TEACHER,
'index' => self::GROUP_STUDENT,
'index' => self::GROUP_VISITOR,
'export2csv' => self::GROUP_TEACHER,
];

View File

@ -53,7 +53,7 @@ class gallery extends common
'add' => self::GROUP_TEACHER,
'theme' => self::GROUP_TEACHER,
'option' => self::GROUP_TEACHER,
'index' => self::GROUP_STUDENT
'index' => self::GROUP_VISITOR
];
public static $sort = [

View File

@ -28,8 +28,8 @@ class news extends common
// paramétrage des news
'delete' => self::GROUP_TEACHER,
'edit' => self::GROUP_TEACHER,
'index' => self::GROUP_STUDENT,
'rss' => self::GROUP_STUDENT
'index' => self::GROUP_VISITOR,
'rss' => self::GROUP_VISITOR
];
public static $news = [];

View File

@ -22,7 +22,7 @@ class redirection extends common
public static $actions = [
'config' => self::GROUP_TEACHER,
'index' => self::GROUP_STUDENT
'index' => self::GROUP_VISITOR
];

View File

@ -25,7 +25,7 @@ class search extends common
const DATADIRECTORY = self::DATA_DIR . 'search/';
public static $actions = [
'index' => self::GROUP_STUDENT,
'index' => self::GROUP_VISITOR,
'config' => self::GROUP_TEACHER
];

View File

@ -24,7 +24,7 @@ class slider extends common
'theme' => self::GROUP_MODERATOR,
'delete' => self::GROUP_MODERATOR,
'dirs' => self::GROUP_MODERATOR,
'index' => self::GROUP_STUDENT
'index' => self::GROUP_VISITOR
];
const VERSION = '6.0';