Création du groupe

This commit is contained in:
Fred Tempez 2023-03-10 10:19:22 +01:00
parent e0ac420cd4
commit 58671aeea9
6 changed files with 130 additions and 40 deletions

View File

@ -32,7 +32,7 @@ class common
const GROUP_VISITOR = 0;
const GROUP_MEMBER = 1;
const GROUP_MODERATOR = 2;
const GROUP_ADMIN = 3;
const GROUP_ADMIN = 99;
const SIGNATURE_ID = 1;
const SIGNATURE_PSEUDO = 2;
const SIGNATURE_FIRSTLASTNAME = 3;
@ -55,7 +55,7 @@ class common
// Numéro de version et branche pour l'auto-update
const ZWII_VERSION = '12.4.00';
const ZWII_DATAVERSION = 12300;
const ZWII_DATAVERSION = 12400;
// URL autoupdate
const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/';

View File

@ -957,3 +957,22 @@ if ($this->getData(['core', 'dataVersion']) < 12300) {
// Mise à jour
$this->setData(['core', 'dataVersion', 12300]);
}
// Version 12.4.00
if ($this->getData(['core', 'dataVersion']) < 12400) {
// Affecter le groupe 99 aux admins
$users = $this->getData(['user']);
foreach ($users as $key => $value) {
if ($value['group'] === 3) {
$this->setData(['user', $key, 'group', 99]);
}
}
// Création des modèles de groupe
// Mise à jour
$this->setData(['core', 'dataVersion', 12400]);
}

View File

@ -334,7 +334,33 @@ class init extends common
],
'blacklist' => [],
'language'=> [],
'group' => [],
'group' => [
-1 => [
'name' => 'Banni',
'readonly' => true,
'comment' => 'Inscription désactivée'
],
0 => [
'name' => 'Visiteur',
'readonly' => true,
'comment' => 'Accès aux pages privées'
],
1 => [
'name' => 'Membre',
'readonly' => true,
'comment' => 'Accède aux pages réservées'
],
2 => [
'name' => 'Editeur',
'readonly' => false,
'comment' => 'Edition des pages'
],
99 => [
'name' => 'Administrateur',
'readonly' => true,
'comment' => 'Contrôle total'
]
],
];
public static $defaultDataI18n = [
'en_EN' => [

View File

@ -396,6 +396,23 @@ class user extends common
]);
}
/**
* Table des groupes
*/
public function group()
{
$groups = $this->getData(['group']);
foreach ($groups as $key => $value) {
}
// Valeurs en sortie
$this->addOutput([
'title' => helper::translate('Groupes'),
'view' => 'group'
]);
}
/**
* Connexion
*/
@ -544,6 +561,7 @@ class user extends common
]);
}
/**
* Déconnexion
*/
@ -613,7 +631,6 @@ class user extends common
'title' => helper::translate('Réinitialisation du mot de passe'),
'view' => 'reset',
'display' => self::DISPLAY_LAYOUT_LIGHT,
]);
}
}
@ -680,15 +697,18 @@ class user extends common
// Enregistre le user
$create = $this->setData([
'user',
$userId, [
$userId,
[
'firstname' => $item['prenom'],
'forgot' => 0,
'group' => $item['groupe'],
'lastname' => $item['nom'],
'mail' => $item['email'],
'pseudo' => $item['prenom'],
'signature' => 1, // Pseudo
'password' => uniqid(), // A modifier à la première connexion
'signature' => 1,
// Pseudo
'password' => uniqid(),
// A modifier à la première connexion
"connectFail" => null,
"connectTimeout" => null,
"accessUrl" => null,
@ -755,7 +775,8 @@ class user extends common
/**
* Télécharge un modèle
*/
public function template() {
public function template()
{
$file = 'template.csv';
$path = 'core/module/user/ressource/';
// Téléchargement du CSV
@ -768,10 +789,4 @@ class user extends common
exit();
}
/**
* Table des groupes
*/
public function group() {
}
}

View File

@ -0,0 +1,18 @@
/**
* This file is part of Zwii.
*
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2023, Frédéric Tempez
* @license CC Attribution-NonCommercial-NoDerivatives 4.0 International
* @link http://zwiicms.fr/
*/
/** NE PAS EFFACER
* admin.css
*/

View File

@ -0,0 +1,12 @@
<div class="row">
<div class="col1">
<?php echo template::button('userGroupBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . 'user',
'value' => template::ico('left')
]); ?>
</div>
<div class="col2 offset9">
<?php echo template::submit('userGroupSubmit'); ?>
</div>
</div>