forked from ZwiiCMS-Team/ZwiiCMS
Permissions en test
This commit is contained in:
parent
1e2f6b9a6b
commit
6477265a8a
@ -1449,7 +1449,7 @@ class common {
|
|||||||
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module',$parent]), 'publishedOn', 'SORT_DESC'));
|
$articleIds = array_keys(helper::arrayCollumn($this->getData(['module',$parent]), 'publishedOn', 'SORT_DESC'));
|
||||||
foreach ($articleIds as $key => $article) {
|
foreach ($articleIds as $key => $article) {
|
||||||
// Droits les deux groupes
|
// Droits les deux groupes
|
||||||
$this->setData(['module', $parent, $article,'editConsent','group']);
|
$this->setData(['module', $parent, $article,'editConsent', 3]);
|
||||||
// Limite de taille 500
|
// Limite de taille 500
|
||||||
$this->setData(['module', $parent, $article,'commentMaxlength', '500']);
|
$this->setData(['module', $parent, $article,'commentMaxlength', '500']);
|
||||||
// Pas d'approbation des commentaires
|
// Pas d'approbation des commentaires
|
||||||
|
@ -78,7 +78,7 @@ class blog extends common {
|
|||||||
// Permissions d'un article
|
// Permissions d'un article
|
||||||
public static $articleConsent = [
|
public static $articleConsent = [
|
||||||
self::EDIT_GROUP => 'Groupe du propriétaire',
|
self::EDIT_GROUP => 'Groupe du propriétaire',
|
||||||
self::EDIT_OWNER => 'Propiétaire'
|
self::EDIT_OWNER => 'Propiétaire'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ class blog extends common {
|
|||||||
'state' => $this->getInput('blogAddState', helper::FILTER_BOOLEAN),
|
'state' => $this->getInput('blogAddState', helper::FILTER_BOOLEAN),
|
||||||
'title' => $this->getInput('blogAddTitle', helper::FILTER_STRING_SHORT, true),
|
'title' => $this->getInput('blogAddTitle', helper::FILTER_STRING_SHORT, true),
|
||||||
'userId' => $newuserid,
|
'userId' => $newuserid,
|
||||||
'editConsent' => $this->getInput('blogAddConsent'),
|
'editConsent' => $this->getInput('blogEditConsent') === self::EDIT_GROUP ? $this->getUser('group') : self::EDIT_OWNER,
|
||||||
'commentMaxlength' => $this->getInput('blogAddCommentMaxlength'),
|
'commentMaxlength' => $this->getInput('blogAddCommentMaxlength'),
|
||||||
'commentApproved' => $this->getInput('blogAddCommentApproved', helper::FILTER_BOOLEAN),
|
'commentApproved' => $this->getInput('blogAddCommentApproved', helper::FILTER_BOOLEAN),
|
||||||
'commentClose' => $this->getInput('blogAddCommentClose', helper::FILTER_BOOLEAN),
|
'commentClose' => $this->getInput('blogAddCommentClose', helper::FILTER_BOOLEAN),
|
||||||
@ -304,14 +304,14 @@ class blog extends common {
|
|||||||
// Gestion des droits d'accès
|
// Gestion des droits d'accès
|
||||||
$filterData=[];
|
$filterData=[];
|
||||||
foreach ($articleIds as $key => $value) {
|
foreach ($articleIds as $key => $value) {
|
||||||
$consent = $this->getData(['module', $this->getUrl(0), $value,'editConsent']);
|
|
||||||
if (
|
if (
|
||||||
(
|
( // Propriétaire
|
||||||
$consent === self::EDIT_OWNER
|
$this->getData(['module', $this->getUrl(0), $value,'editConsent']) === self::EDIT_OWNER
|
||||||
AND $this->getData(['module', $this->getUrl(0), $value,'userId']) === $this->getUser('id')
|
AND $this->getData(['module', $this->getUrl(0), $value,'userId']) === $this->getUser('id')
|
||||||
) OR (
|
) OR (
|
||||||
$consent === self::EDIT_GROUP
|
// Groupe
|
||||||
AND $this->getUser('group') >= $this->getData(['user',$this->getUser('group'),'group'])
|
$this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) !== self::EDIT_OWNER
|
||||||
|
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), $value,'editConsent'])
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
$filterData[] = $value;
|
$filterData[] = $value;
|
||||||
@ -448,7 +448,7 @@ class blog extends common {
|
|||||||
'state' => $this->getInput('blogEditState', helper::FILTER_BOOLEAN),
|
'state' => $this->getInput('blogEditState', helper::FILTER_BOOLEAN),
|
||||||
'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true),
|
'title' => $this->getInput('blogEditTitle', helper::FILTER_STRING_SHORT, true),
|
||||||
'userId' => $newuserid,
|
'userId' => $newuserid,
|
||||||
'editConsent' => $this->getInput('blogEditConsent'),
|
'editConsent' => $this->getInput('blogEditConsent') === self::EDIT_GROUP ? $this->getUser('group') : self::EDIT_OWNER,
|
||||||
'commentMaxlength' => $this->getInput('blogEditCommentMaxength'),
|
'commentMaxlength' => $this->getInput('blogEditCommentMaxength'),
|
||||||
'commentApproved' => $this->getInput('blogEditCommentApproved', helper::FILTER_BOOLEAN),
|
'commentApproved' => $this->getInput('blogEditCommentApproved', helper::FILTER_BOOLEAN),
|
||||||
'commentClose' => $this->getInput('blogEditCommentClose', helper::FILTER_BOOLEAN),
|
'commentClose' => $this->getInput('blogEditCommentClose', helper::FILTER_BOOLEAN),
|
||||||
|
@ -7,16 +7,24 @@
|
|||||||
à <?php echo strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'publishedOn'])); ?>
|
à <?php echo strftime('%H:%M', $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'publishedOn'])); ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php if(
|
<?php if (
|
||||||
$this->getUser('group') >= self::GROUP_ADMIN
|
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
||||||
AND $this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
AND
|
||||||
|
( // Propriétaire
|
||||||
|
$this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER
|
||||||
|
AND $this->getData(['module', $this->getUrl(0), $this->getUrl(1),'userId']) === $this->getUser('id')
|
||||||
|
) OR (
|
||||||
|
// Groupe
|
||||||
|
$this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) !== $module::EDIT_OWNER
|
||||||
|
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), $this->getUrl(1),'editConsent'])
|
||||||
|
)
|
||||||
): ?>
|
): ?>
|
||||||
<div class="col2">
|
<div class="col2">
|
||||||
<?php echo template::button('blogEdit', [
|
<?php echo template::button('blogEdit', [
|
||||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'],
|
'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'],
|
||||||
'value' => 'Editer'
|
'value' => 'Editer'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php $pictureSize = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'pictureSize']); ?>
|
<?php $pictureSize = $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), $this->getUrl(1), 'pictureSize']); ?>
|
||||||
|
Loading…
Reference in New Issue
Block a user