Profil droit sur l'édition du compte

This commit is contained in:
Fred Tempez 2023-06-28 22:34:37 +02:00
parent 5fdcfdd7bd
commit 1271185c5d
5 changed files with 71 additions and 10 deletions

View File

@ -344,7 +344,10 @@ class layout extends common
$items .= $this->getData(['theme', 'footer', 'displaymemberAccount']) === false ? ' class="displayNone">' : '>'; $items .= $this->getData(['theme', 'footer', 'displaymemberAccount']) === false ? ' class="displayNone">' : '>';
$items .= '<wbr>&nbsp;|&nbsp;'; $items .= '<wbr>&nbsp;|&nbsp;';
if ( if (
$this->getUser('permission','filemanager') === true $this->getUser(
'permission',
'filemanager'
) === true
) { ) {
$items .= '<wbr>' . template::ico('folder', [ $items .= '<wbr>' . template::ico('folder', [
'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']), 'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']),
@ -498,7 +501,11 @@ class layout extends common
&& $this->getData(['theme', 'menu', 'memberBar']) === true && $this->getData(['theme', 'menu', 'memberBar']) === true
) { ) {
if ( if (
$this->getUser('group') >= self::GROUP_MEMBER && $this->getUser('permission','folder', 'share') === true $this->getUser('group') >= self::GROUP_MEMBER && $this->getUser(
'permission',
'folder',
'share'
) === true
) { ) {
$itemsRight .= '<li>' . template::ico('folder', [ $itemsRight .= '<li>' . template::ico('folder', [
'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']), 'href' => helper::baseUrl(false) . 'core/vendor/filemanager/dialog.php?type=0&akey=' . md5_file(self::DATA_DIR . 'core.json') . '&lang=' . $this->getData(['user', $this->getUser('id'), 'language']),
@ -936,7 +943,7 @@ class layout extends common
$leftItems .= '</optgroup>'; $leftItems .= '</optgroup>';
$leftItems .= '</select></li>'; $leftItems .= '</select></li>';
// Bouton Ajouter une page // Bouton Ajouter une page
if ($this->getUser('permission','page', 'add')) { if ($this->getUser('permission', 'page', 'add')) {
$leftItems .= '<li>' . template::ico('plus', [ $leftItems .= '<li>' . template::ico('plus', [
'href' => helper::baseUrl() . 'page/add', 'href' => helper::baseUrl() . 'page/add',
'help' => 'Nouvelle page ou barre latérale' 'help' => 'Nouvelle page ou barre latérale'
@ -955,7 +962,7 @@ class layout extends common
or $this->getUrl(0) === '' or $this->getUrl(0) === ''
) { ) {
// Bouton Editer une page // Bouton Editer une page
if ($this->getUser('permission','page', 'edit')) { if ($this->getUser('permission', 'page', 'edit')) {
$leftItems .= '<li>' . template::ico('pencil', [ $leftItems .= '<li>' . template::ico('pencil', [
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), 'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0),
'help' => 'Éditer la page' 'help' => 'Éditer la page'
@ -963,7 +970,7 @@ class layout extends common
} }
// Bouton Editer le module d'une page // Bouton Editer le module d'une page
if ( if (
$this->getUser('permission','page', 'module') $this->getUser('permission', 'page', 'module')
&& $this->getData(['page', $this->getUrl(0), 'moduleId']) && $this->getData(['page', $this->getUrl(0), 'moduleId'])
) { ) {
$leftItems .= '<li>' . template::ico('gear', [ $leftItems .= '<li>' . template::ico('gear', [
@ -973,7 +980,7 @@ class layout extends common
} }
// Bouton dupliquer une page // Bouton dupliquer une page
if ( if (
$this->getUser('permission','page', 'duplicate') $this->getUser('permission', 'page', 'duplicate')
) { ) {
$leftItems .= '<li>' . template::ico('clone', [ $leftItems .= '<li>' . template::ico('clone', [
'href' => helper::baseUrl() . 'page/duplicate/' . $this->getUrl(0), 'href' => helper::baseUrl() . 'page/duplicate/' . $this->getUrl(0),
@ -983,7 +990,7 @@ class layout extends common
} }
// Bouton Effacer une page // Bouton Effacer une page
if ( if (
$this->getUser('permission','page', 'delete') $this->getUser('permission', 'page', 'delete')
) { ) {
$leftItems .= '<li>' . template::ico('trash', [ $leftItems .= '<li>' . template::ico('trash', [
'href' => helper::baseUrl() . 'page/delete/' . $this->getUrl(0), 'href' => helper::baseUrl() . 'page/delete/' . $this->getUrl(0),
@ -998,7 +1005,10 @@ class layout extends common
$rightItems = ''; $rightItems = '';
if ( if (
$this->getUser('group') >= self::GROUP_MODERATOR $this->getUser('group') >= self::GROUP_MODERATOR
&& $this->getUser('permission','filemanager') && $this->getUser(
'permission',
'filemanager'
)
) { ) {
$rightItems .= '<li>' . template::ico('folder', [ $rightItems .= '<li>' . template::ico('folder', [
'help' => 'Fichiers', 'help' => 'Fichiers',
@ -1027,7 +1037,6 @@ class layout extends common
'help' => 'Utilisateurs', 'help' => 'Utilisateurs',
'href' => helper::baseUrl() . 'user' 'href' => helper::baseUrl() . 'user'
]) . '</li>'; ]) . '</li>';
// Mise à jour automatique // Mise à jour automatique
$today = mktime(0, 0, 0); $today = mktime(0, 0, 0);
$checkUpdate = $this->getData(['core', 'lastAutoUpdate']); $checkUpdate = $this->getData(['core', 'lastAutoUpdate']);
@ -1054,7 +1063,11 @@ class layout extends common
$rightItems .= '<li><a href="' . helper::baseUrl() . 'install/update" data-tippy-content="Mettre à jour Zwii ' . common::ZWII_VERSION . ' vers ' . helper::getOnlineVersion(common::ZWII_UPDATE_CHANNEL) . '">' . template::ico('update colorRed') . '</a></li>'; $rightItems .= '<li><a href="' . helper::baseUrl() . 'install/update" data-tippy-content="Mettre à jour Zwii ' . common::ZWII_VERSION . ' vers ' . helper::getOnlineVersion(common::ZWII_UPDATE_CHANNEL) . '">' . template::ico('update colorRed') . '</a></li>';
} }
} }
if ($this->getUser('group') >= self::GROUP_MODERATOR) { if (
$this->getUser('group') >= self::GROUP_MODERATOR
&& $this->getUser('permission', 'user', 'edit')
) {
$rightItems .= '<li><a href="' . helper::baseUrl() . 'user/edit/' . $this->getUser('id') . $rightItems .= '<li><a href="' . helper::baseUrl() . 'user/edit/' . $this->getUser('id') .
'" data-tippy-content="' . helper::translate('Configurer mon compte') . '">' . '" data-tippy-content="' . helper::translate('Configurer mon compte') . '">' .
template::ico('user', ['margin' => 'right']) . '<span id="displayUsername">' . $this->getUser('firstname') . ' ' . $this->getUser('lastname') . template::ico('user', ['margin' => 'right']) . '<span id="displayUsername">' . $this->getUser('firstname') . ' ' . $this->getUser('lastname') .

View File

@ -384,6 +384,9 @@ class init extends common
], ],
'search' => [ 'search' => [
'config' => false, 'config' => false,
],
'user' => [
'edit' => true,
] ]
], ],
'2' => [ '2' => [
@ -464,6 +467,9 @@ class init extends common
], ],
'search' => [ 'search' => [
'config' => false, 'config' => false,
],
'user' => [
'edit' => true,
] ]
], ],
], ],
@ -544,6 +550,9 @@ class init extends common
], ],
'search' => [ 'search' => [
'config' => true, 'config' => true,
],
'user' => [
'edit' => true,
] ]
], ],
'2' => [ '2' => [
@ -621,6 +630,9 @@ class init extends common
], ],
'search' => [ 'search' => [
'config' => true, 'config' => true,
],
'user' => [
'edit' => true,
] ]
], ],
], ],

View File

@ -636,6 +636,9 @@ class user extends common
'redirection' => [ 'redirection' => [
'config' => $this->getInput('profilEditRedirectionConfig', helper::FILTER_BOOLEAN), 'config' => $this->getInput('profilEditRedirectionConfig', helper::FILTER_BOOLEAN),
], ],
'user' => [
'edit' => $this->getInput('profilEditUserEdit', helper::FILTER_BOOLEAN),
]
] ]
]); ]);
@ -768,6 +771,9 @@ class user extends common
'redirection' => [ 'redirection' => [
'config' => $this->getInput('profilAddRedirectionConfig', helper::FILTER_BOOLEAN), 'config' => $this->getInput('profilAddRedirectionConfig', helper::FILTER_BOOLEAN),
], ],
'user' => [
'edit' => $this->getInput('profilAddUserEdit', helper::FILTER_BOOLEAN),
]
] ]
]); ]);
// Valeurs en sortie // Valeurs en sortie

View File

@ -45,6 +45,20 @@
</div> </div>
</div> </div>
<div class="row containerPage"> <div class="row containerPage">
<div class="row">
<div class="col12">
<div class="block">
<h4>
<?php echo helper::translate('Compte utilisateur'); ?>
</h4>
<div class="row">
<div class="col3">
<?php echo template::checkbox('profilAddUserEdit', true, 'Éditer'); ?>
</div>
</div>
</div>
</div>
</div>
<div class="col12"> <div class="col12">
<div class="block"> <div class="block">
<h4> <h4>

View File

@ -52,6 +52,22 @@
</div> </div>
</div> </div>
<?php if ($this->getUrl(2) >= self::GROUP_MODERATOR): ?> <?php if ($this->getUrl(2) >= self::GROUP_MODERATOR): ?>
<div class="row">
<div class="col12">
<div class="block">
<h4>
<?php echo helper::translate('Compte utilisateur'); ?>
</h4>
<div class="row">
<div class="col3">
<?php echo template::checkbox('profilEditUserEdit', true, 'Éditer', [
'checked' => $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'user', 'edit'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<div class="block"> <div class="block">