diff --git a/core/core.php b/core/core.php index 7b04464d..fd60aa98 100644 --- a/core/core.php +++ b/core/core.php @@ -32,7 +32,7 @@ class common const GROUP_VISITOR = 0; const GROUP_MEMBER = 1; const GROUP_MODERATOR = 2; - const GROUP_ADMIN = 99; + const GROUP_ADMIN = 3; const SIGNATURE_ID = 1; const SIGNATURE_PSEUDO = 2; const SIGNATURE_FIRSTLASTNAME = 3; diff --git a/core/module/user/user.php b/core/module/user/user.php index b8c26517..dbf7910e 100644 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -417,14 +417,14 @@ class user extends common // Membres sans permissions spécifiques if ( - $groupId == -1 || - $groupId == 0 || - $groupId == 3 + $groupId == self::GROUP_BANNED || + $groupId == self::GROUP_VISITOR || + $groupId == self::GROUP_ADMIN ) { self::$userGroups[$groupId] = [ $groupId, $groupData['name'], - $groupData['comment'], + nl2br($groupData['comment']), template::button('permissionEdit' . $groupId, [ 'href' => helper::baseUrl() . 'user/permissionEdit/' . $groupId . '/' . $_SESSION['csrf'], 'value' => template::ico('pencil'), @@ -438,24 +438,26 @@ class user extends common 'help' => 'Supprimer', 'disabled' => $groupData['readonly'], ]) - ]; - } else { + ]; + } elseif ( + $groupId == self::GROUP_MEMBER || + $groupId == self::GROUP_MODERATOR + ) { // Enumérer les sous groupes MEMBER et MODERATOR foreach ($groupData as $subGroupId => $subGroupData) { - echo $subGroupId; self::$userGroups[$groupId.'.'.$subGroupId] = [ $groupId . '-' . $subGroupId, - $subGroupData['name'], - $subGroupData['comment'], + self::$groups[$groupId] .'
Profil : '. $subGroupData['name'], + nl2br($subGroupData['comment']), template::button('permissionEdit' . $groupId.$subGroupId, [ - 'href' => helper::baseUrl() . 'user/permissionEdit/' . $groupId . '-' . $subGroupId . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . 'user/permissionEdit/' . $groupId . '/' . $subGroupId . '/' . $_SESSION['csrf'], 'value' => template::ico('pencil'), 'help' => 'Éditer', 'disabled' => $subGroupData['readonly'], ]), template::button('permissionDelete' . $groupId.$subGroupId, [ 'class' => 'userDelete buttonRed', - 'href' => helper::baseUrl() . 'user/permissionDelete/' . $groupId . '-' . $subGroupId . '/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . 'user/permissionDelete/' . $groupId . '/' . $subGroupId . '/' . $_SESSION['csrf'], 'value' => template::ico('trash'), 'help' => 'Supprimer', 'disabled' => $subGroupData['readonly'], @@ -477,7 +479,7 @@ class user extends common public function permissionEdit() { if ( - $this->getUrl(3) !== $_SESSION['csrf'] + $this->getUrl(4) !== $_SESSION['csrf'] ) { // Valeurs en sortie @@ -490,13 +492,15 @@ class user extends common // Soumission du formulaire if ($this->isPost()) { $group = $this->getUrl(2); + $profil = $this->getUrl(3); $this->setData([ 'permission', $group, + $profil, [ - 'name' => $this->getData(['permission', $group, 'name']), - 'readonly' => $this->getData(['permission', $group, 'readonly']), - 'comment' => $this->getData(['permission', $group, 'comment']), + 'name' => $this->getInput('permissionEditName', null, true), + 'readonly' => false, + 'comment' => $this->getInput('permissionEditComment', helper::FILTER_STRING_SHORT, true), 'file' => [ 'download' => $this->getInput('permissionEditDownload', helper::FILTER_BOOLEAN), 'edit' => $this->getInput('permissionEditEdit', helper::FILTER_BOOLEAN), @@ -535,7 +539,7 @@ class user extends common // Valeurs en sortie; $this->addOutput([ - 'title' => sprintf(helper::translate('Groupe %s'), $this->getData(['permission', $this->getUrl(2), 'name'])), + 'title' => sprintf(helper::translate('Groupe : %s - Profil : %s'), $this->getData(['permission', $this->getUrl(2), 'name']), $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'name'])), 'view' => 'permissionEdit' ]); } diff --git a/core/module/user/view/permission/permission.php b/core/module/user/view/permission/permission.php index 637d7331..a29d5e2d 100644 --- a/core/module/user/view/permission/permission.php +++ b/core/module/user/view/permission/permission.php @@ -7,4 +7,4 @@ ]); ?> - \ No newline at end of file + \ No newline at end of file diff --git a/core/module/user/view/permissionEdit/permissionEdit.php b/core/module/user/view/permissionEdit/permissionEdit.php index f9992c73..df3fa359 100644 --- a/core/module/user/view/permissionEdit/permissionEdit.php +++ b/core/module/user/view/permissionEdit/permissionEdit.php @@ -11,6 +11,29 @@ +
+
+
+

+ +

+
+
+ 'Profil', + 'value' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'name']) + ]); ?> +
+
+ 'Commentaire', + 'value' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'comment']) + ]); ?> +
+
+
+
+
@@ -20,13 +43,13 @@
$this->getData(['permission', $this->getUrl(2), 'folder', 'share']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'folder', 'share']) ]); ?>
'Racine du dossier', - 'selected' => $this->getData(['permission', $this->getUrl(2), 'folder', 'path']) + 'selected' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'folder', 'path']) ]); ?>
@@ -39,27 +62,27 @@
$this->getData(['permission', $this->getUrl(2), 'folder', 'create']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'folder', 'create']) ]); ?>
$this->getData(['permission', $this->getUrl(2), 'folder', 'delete']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'folder', 'delete']) ]); ?>
$this->getData(['permission', $this->getUrl(2), 'folder', 'rename']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'folder', 'rename']) ]); ?>
$this->getData(['permission', $this->getUrl(2), 'folder', 'copycut']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'folder', 'copycut']) ]); ?>
$this->getData(['permission', $this->getUrl(2), 'folder', 'permission']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'folder', 'permission']) ]); ?>
@@ -75,59 +98,59 @@
$this->getData(['permission', $this->getUrl(2), 'file', 'download']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'file', 'download']) ]); ?>
$this->getData(['permission', $this->getUrl(2), 'file', 'edit']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'file', 'edit']) ]); ?>
$this->getData(['permission', $this->getUrl(2), 'file', 'create']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'file', 'create']) ]); ?>
$this->getData(['permission', $this->getUrl(2), 'file', 'rename']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'file', 'rename']) ]); ?>
$this->getData(['permission', $this->getUrl(2), 'file', 'upload']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'file', 'upload']) ]); ?>
$this->getData(['permission', $this->getUrl(2), 'file', 'delete']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'file', 'delete']) ]); ?>
$this->getData(['permission', $this->getUrl(2), 'file', 'preview']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'file', 'preview']) ]); ?>
$this->getData(['permission', $this->getUrl(2), 'file', 'duplicate']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'file', 'duplicate']) ]); ?>
$this->getData(['permission', $this->getUrl(2), 'file', 'extract']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'file', 'extract']) ]); ?>
$this->getData(['permission', $this->getUrl(2), 'file', 'copycut']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'file', 'copycut']) ]); ?>
$this->getData(['permission', $this->getUrl(2), 'file', 'permission']) + 'checked' => $this->getData(['permission', $this->getUrl(2), $this->getUrl(3), 'file', 'permission']) ]); ?>