Permissions du blog

This commit is contained in:
Fred Tempez 2020-10-14 11:07:38 +02:00
parent 174e087fc3
commit f9eb28f6f3
2 changed files with 14 additions and 4 deletions

View File

@ -16,6 +16,7 @@ class blog extends common {
const EDIT_OWNER = 'owner'; const EDIT_OWNER = 'owner';
const EDIT_GROUP = 'group'; const EDIT_GROUP = 'group';
const EDIT_ALL = 'all';
public static $actions = [ public static $actions = [
'add' => self::GROUP_EDITOR, 'add' => self::GROUP_EDITOR,
@ -77,12 +78,12 @@ class blog extends common {
// Permissions d'un article // Permissions d'un article
public static $articleConsent = [ public static $articleConsent = [
self::EDIT_ALL => 'Tous les groupes',
self::EDIT_GROUP => 'Groupe du propriétaire', self::EDIT_GROUP => 'Groupe du propriétaire',
self::EDIT_OWNER => 'Propiétaire' self::EDIT_OWNER => 'Propiétaire'
]; ];
public static $users = []; public static $users = [];
const BLOG_VERSION = '3.05.dev'; const BLOG_VERSION = '3.05.dev';
@ -312,11 +313,15 @@ class blog extends common {
AND $this->getUser('group') >= self::GROUP_EDITOR AND $this->getUser('group') >= self::GROUP_EDITOR
) )
) OR ( OR (
// Groupe // Groupe
$this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) !== self::EDIT_OWNER $this->getData(['module', $this->getUrl(0), $value,'editConsent'])) !== self::EDIT_OWNER
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), $value,'editConsent']) AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), $value,'editConsent'])
) )
OR (
// Tout le monde
$this->getData(['module', $this->getUrl(0), $value,'editConsent']) === self::EDIT_ALL
)
) { ) {
$filterData[] = $value; $filterData[] = $value;
} }
@ -689,3 +694,4 @@ class blog extends common {
} }
} }
} }

View File

@ -22,6 +22,10 @@
$this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) !== $module::EDIT_OWNER $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']) AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), $this->getUrl(1),'editConsent'])
) )
OR (
// Tout le monde
$this->getData(['module', $this->getUrl(0), $this->getUrl(1),'editConsent']) === $module::EDIT_ALL
)
): ?> ): ?>
<?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'],