Rôles renommés, fonctions pour déterminer les droits d'accès à un cours, le sous ensembles teacher et students sont supprimés dans enrolment, le profil et le groupe moodle comptent

This commit is contained in:
Fred Tempez 2023-09-21 19:32:30 +02:00
parent 0e6b843b1d
commit 727f8123c0
23 changed files with 104 additions and 134 deletions

View File

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

View File

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

View File

@ -25,8 +25,8 @@ class common
const DISPLAY_LAYOUT_MAIN = 4; const DISPLAY_LAYOUT_MAIN = 4;
const DISPLAY_LAYOUT_LIGHT = 5; const DISPLAY_LAYOUT_LIGHT = 5;
const GROUP_BANNED = -1; const GROUP_BANNED = -1;
const GROUP_VISITOR = 0; const GROUP_STUDENT = 0;
const GROUP_STUDENT = 1; const GROUP_TUTOR = 1;
const GROUP_TEACHER = 2; const GROUP_TEACHER = 2;
// Groupe MODERATOR, compatibilité avec les anciens modules : // Groupe MODERATOR, compatibilité avec les anciens modules :
const GROUP_ADMIN = 3; const GROUP_ADMIN = 3;
@ -94,14 +94,6 @@ class common
'theme', 'theme',
'user' 'user'
]; ];
/*
Cette variable est supprimée du test dans le routeur.
public static $accessExclude = [
'login',
'logout',
'maintenance',
];
*/
private $data = []; private $data = [];
private $hierarchy = [ private $hierarchy = [
'all' => [], 'all' => [],
@ -153,25 +145,25 @@ class common
]; ];
public static $groups = [ public static $groups = [
self::GROUP_BANNED => 'Banni', self::GROUP_BANNED => 'Banni',
self::GROUP_VISITOR => 'Visiteur',
self::GROUP_STUDENT => 'Apprenant', self::GROUP_STUDENT => 'Apprenant',
self::GROUP_TUTOR => 'Tuteur',
self::GROUP_TEACHER => 'Enseignant', self::GROUP_TEACHER => 'Enseignant',
self::GROUP_ADMIN => 'Administrateur' self::GROUP_ADMIN => 'Administrateur'
]; ];
public static $groupEdits = [ public static $groupEdits = [
self::GROUP_BANNED => 'Banni', self::GROUP_BANNED => 'Banni',
self::GROUP_STUDENT => 'Apprenant', self::GROUP_TUTOR => 'Tuteur',
self::GROUP_TEACHER => 'Enseignant', self::GROUP_TEACHER => 'Enseignant',
self::GROUP_ADMIN => 'Administrateur' self::GROUP_ADMIN => 'Administrateur'
]; ];
public static $groupNews = [ public static $groupNews = [
self::GROUP_STUDENT => 'Apprenant', self::GROUP_TUTOR => 'Tuteur',
self::GROUP_TEACHER => 'Enseignant', self::GROUP_TEACHER => 'Enseignant',
self::GROUP_ADMIN => 'Administrateur' self::GROUP_ADMIN => 'Administrateur'
]; ];
public static $groupPublics = [ public static $groupPublics = [
self::GROUP_VISITOR => 'Visiteur',
self::GROUP_STUDENT => 'Apprenant', self::GROUP_STUDENT => 'Apprenant',
self::GROUP_TUTOR => 'Tuteur',
self::GROUP_TEACHER => 'Enseignant', self::GROUP_TEACHER => 'Enseignant',
self::GROUP_ADMIN => 'Administrateur' self::GROUP_ADMIN => 'Administrateur'
]; ];
@ -453,7 +445,6 @@ class common
// Mise à jour des données core // Mise à jour des données core
include('core/include/update.inc.php'); include('core/include/update.inc.php');
} }
@ -720,7 +711,7 @@ class common
// Page parent // Page parent
$this->getData(['page', $pageId, 'parentPageId']) === '' $this->getData(['page', $pageId, 'parentPageId']) === ''
// Ignore les pages dont l'utilisateur n'a pas accès // Ignore les pages dont l'utilisateur n'a pas accès
and ($this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR and ($this->getData(['page', $pageId, 'group']) === self::GROUP_STUDENT
or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
//and $this->getUser('group') >= $this->getData(['page', $pageId, 'group']) //and $this->getUser('group') >= $this->getData(['page', $pageId, 'group'])
// Modification qui tient compte du profil de la page // Modification qui tient compte du profil de la page
@ -745,8 +736,8 @@ class common
$parentId = $this->getData(['page', $pageId, 'parentPageId']) $parentId = $this->getData(['page', $pageId, 'parentPageId'])
// Ignore les pages dont l'utilisateur n'a pas accès // Ignore les pages dont l'utilisateur n'a pas accès
and ( and (
($this->getData(['page', $pageId, 'group']) === self::GROUP_VISITOR ($this->getData(['page', $pageId, 'group']) === self::GROUP_STUDENT
and $this->getData(['page', $parentId, 'group']) === self::GROUP_VISITOR and $this->getData(['page', $parentId, 'group']) === self::GROUP_STUDENT
) )
or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD') or ($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
//and $this->getUser('group') >= $this->getData(['page', $parentId, 'group']) //and $this->getUser('group') >= $this->getData(['page', $parentId, 'group'])
@ -1439,11 +1430,12 @@ class common
return $c; return $c;
case self::GROUP_TEACHER: case self::GROUP_TEACHER:
foreach ($c as $courseId => $value) { foreach ($c as $courseId => $value) {
if ($this->getData(['enrolment', $courseId, 'teacher']) !== $userId) { if ($this->getData(['enrolment', $courseId]) !== $userId) {
unset($c[$courseId]); unset($c[$courseId]);
} }
} }
return $c; return $c;
case self::GROUP_TUTOR:
case self::GROUP_STUDENT: case self::GROUP_STUDENT:
foreach ($c as $courseId => $value) { foreach ($c as $courseId => $value) {
$students = $this->getData(['enrolment', $courseId, 'students']); $students = $this->getData(['enrolment', $courseId, 'students']);
@ -1463,45 +1455,31 @@ class common
* @param string $userId identifiant de l'utilisateur * @param string $userId identifiant de l'utilisateur
* @param string $courseId identifiant du cours sollicité * @param string $courseId identifiant du cours sollicité
*/ */
public function courseUserEnrolment($courseId, $userId) public function courseUserEnrolment($courseId, $userId = null)
{ {
// Modalité d'ouverture du cours $group = $userId ? $this->getData(['user', $userId, 'group']) : false;
// L'utilisateur n'est pas admin switch ($group) {
switch ($this->getData(['user', $userId, 'group'])) {
case self::GROUP_ADMIN: case self::GROUP_ADMIN:
return true; $r = true;
break;
case self::GROUP_TEACHER: case self::GROUP_TEACHER:
return ($userId === $this->getData(['enrolment', $courseId, 'teacher'])); $r = in_array($userId, array_keys($this->getData(['enrolment', $courseId])));
break;
case self::GROUP_TUTOR:
case self::GROUP_STUDENT: case self::GROUP_STUDENT:
return ( $r = $this->courseIsAvailable($courseId) &&
// Le cours est-il ouvert ? (in_array($userId, array_keys($this->getData(['enrolment', $courseId]))) ||
$this->courseIsAvailable($courseId) && $this->getData(['course', $courseId, 'enrolment']) <= self::COURSE_ENROLMENT_SELF);
// L'étudiant est inscrit ? break;
array_search($userId, $this->getData(['enrolment', $courseId, 'students'])) // Visiteur non connecté
); case false:
case self::GROUP_VISITOR: $r = $this->courseIsAvailable($courseId) &&
// Le cours est-il ouvert ? $this->getData(['course', $courseId, 'enrolment']) === self::COURSE_ENROLMENT_GUEST;
return ( break;
$this->courseIsAvailable($courseId) &&
$this->getData(['course', $courseId, 'enrolment']) === self::COURSE_ENROLMENT_GUEST
);
default: default:
return false; $r = false;
}
if ($this->getData(['user', $userId, 'group']) < self::GROUP_ADMIN) {
if (
// le cours est fermé
$this->getData(['course', $courseId, 'access']) === self::COURSE_ACCESS_CLOSE
||
// Le cours ets ouvert entre deux dates
($this->getData(['course', $courseId, 'access']) &&
($this->getData(['course', $courseId, 'openingDate']) >= time() ||
$this->getData(['course', $courseId, 'clodingDate']) <= time())
)
) {
return;
}
} }
return $r;
} }
/** /**

View File

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

View File

@ -21,8 +21,8 @@ class course extends common
'edit' => self::GROUP_ADMIN, 'edit' => self::GROUP_ADMIN,
'add' => self::GROUP_ADMIN, 'add' => self::GROUP_ADMIN,
'delete' => self::GROUP_ADMIN, 'delete' => self::GROUP_ADMIN,
'swap' => self::GROUP_VISITOR, 'swap' => self::GROUP_STUDENT,
'change' => self::GROUP_VISITOR, 'change' => self::GROUP_STUDENT,
]; ];
public static $courseAccess = [ public static $courseAccess = [
@ -42,6 +42,7 @@ class course extends common
public static $courses = []; public static $courses = [];
public static $changeMessages = [];
public function index() public function index()
@ -115,10 +116,7 @@ class course extends common
$this->setData([ $this->setData([
'enrolment', 'enrolment',
$courseId, $courseId,
[ []
'teacher' => $author,
'students' => []
]
]); ]);
// Valeurs en sortie // Valeurs en sortie
@ -205,17 +203,6 @@ class course extends common
] ]
]); ]);
// BDD des inscrits
$students = is_null($this->getData(['enrolment', $courseId, 'students'])) ? [] : $this->getData(['enrolment', $courseId, 'students']);
$this->setData([
'enrolment',
$courseId,
[
'teacher' => $author,
'students' => $students
]
]);
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'redirect' => helper::baseUrl() . 'course', 'redirect' => helper::baseUrl() . 'course',
@ -254,9 +241,16 @@ class course extends common
$this->swap(); $this->swap();
} }
// Bouton de connexion ou d'inscription
// C'est un prof ou un admin
self::$changeMessages = $this->getUser('group') >= self::GROUP_TEACHER
? 'Se connecter'
// C'est un étudiant ou un visiteur
: '';
// Valeurs en sortie // Valeurs en sortie
$this->addOutput([ $this->addOutput([
'title' => sprintf(helper::translate('Accéder au cours %s'), $this->getData(['course', $this->getUrl(2), 'shortTitle' ])), 'title' => sprintf(helper::translate('Accéder au cours %s'), $this->getData(['course', $this->getUrl(2), 'shortTitle'])),
'view' => 'change', 'view' => 'change',
'display' => self::DISPLAY_LAYOUT_LIGHT, 'display' => self::DISPLAY_LAYOUT_LIGHT,
]); ]);

View File

@ -3,7 +3,7 @@
<div class="col12"> <div class="col12">
<?php echo "<h3>Auteur : " . $this->getData(['course', $this->getUrl(2), 'author' ]) . "</h3>"; ?> <?php echo "<h3>Auteur : " . $this->getData(['course', $this->getUrl(2), 'author' ]) . "</h3>"; ?>
<?php echo "<p> Description : " . $this->getData(['course', $this->getUrl(2), 'description' ]) . "</p>"; ?> <?php echo "<p> Description : " . $this->getData(['course', $this->getUrl(2), 'description' ]) . "</p>"; ?>
<?php echo "<p> Disponibilité : " . $module::$courseAccess[$this->getData(['course', $this->getUrl(2), 'access' ])]. "</p>";?> <?php echo "<p> Disponibilité : " . $module::$courseAccess[$this->getData(['course', $this->getUrl(2), 'access' ])] . "</p>";?>
<?php echo "<p> Inscription : " . $module::$courseEnrolment[$this->getData(['course', $this->getUrl(2), 'enrolment' ])]. "</p>";?> <?php echo "<p> Inscription : " . $module::$courseEnrolment[$this->getData(['course', $this->getUrl(2), 'enrolment' ])]. "</p>";?>
</div> </div>
@ -18,6 +18,7 @@
<div class="col3 offset7"> <div class="col3 offset7">
<?php echo template::submit('courseChangeSubmit', [ <?php echo template::submit('courseChangeSubmit', [
'value' => 'Se connecter', 'value' => 'Se connecter',
'disabled' => !$this->courseIsAvailable($this->getUrl(2)),
'ico' => '' 'ico' => ''
]); ?> ]); ?>
</div> </div>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,13 +22,10 @@ BDD contenant les informations sur le cours
- 3 manuel, le prof inscrits - 3 manuel, le prof inscrits
- enrolmentKey clé d'inscription, si non vide - enrolmentKey clé d'inscription, si non vide
data/course/enrolment.json data/enrolment.json
Détermine la liste des inscrits Détermine la liste des inscrits
- userid - userid
- userGroup - lastPageId derrière page visitée
- userProfil - lastDate date de la dernière vue
- lastPageId derrière page visitée Le profil Zwii détermine le rôle de l'utilisateur
- lastDate date de la dernière vue
Règle de gestion :