diff --git a/core/core.php b/core/core.php index c4ff06ca..57a169a2 100644 --- a/core/core.php +++ b/core/core.php @@ -908,25 +908,32 @@ class common */ public function getPermission($key1, $key2 = null) { + // User n'existe pas if (is_array($this->user) === false) { return false; + // Administrateur, toutes les permissions } elseif ($this->getUser('group') === self::GROUP_ADMIN) { return true; + // Groupe sans autorisation } elseif ($this->getUser('group') < 1) { return false; + // Groupe avec profil, consultation des autorisations sur deux clés } elseif ( $key2 && $this->getData(['profil', $this->user['group'], $this->user['profil'], $key1]) && array_key_exists($key2, $this->getData(['profil', $this->user['group'], $this->user['profil'], $key1])) ) { return $this->getData(['profil', $this->user['group'], $this->user['profil'], $key1, $key2]); + // Groupe avec profil, consultation des autorisations sur une seule clé } elseif ( $this->getData(['profil', $this->user['group'], $this->user['profil']]) && array_key_exists($key1, $this->getData(['profil', $this->user['group'], $this->user['profil']])) ) { return $this->getData(['profil', $this->user['group'], $this->user['profil'], $key1]); } else { - return false; + // Permission non spécifiée dans le profil est autorisée par défaut pour le fonctionnement de $action + return true; + //return false; } }