permission routage en test

This commit is contained in:
Fred Tempez 2023-05-13 23:36:02 +02:00
parent 56d7dbedfc
commit 55f8e592c8
2 changed files with 17 additions and 12 deletions

View File

@ -699,9 +699,10 @@ class core extends common
} }
} }
$action = array_key_exists($action, $module::$actions) ? $action : 'index'; $action = array_key_exists($action, $module::$actions) ? $action : 'index';
if (array_key_exists($action, $module::$actions) var_dump( $moduleId);
//&& $this->getPermission($moduleId, $action) var_dump ($action);
){ var_dump ($this->getPermission('user', 'login'));
if (array_key_exists($action, $module::$actions)) {
$module->$action(); $module->$action();
$output = $module->output; $output = $module->output;
// Check le groupe de l'utilisateur // Check le groupe de l'utilisateur

View File

@ -909,24 +909,28 @@ class common
public function getPermission($key1, $key2 = null) public function getPermission($key1, $key2 = null)
{ {
// User n'existe pas // User n'existe pas
if (is_array($this->user) === false) { // if (is_array($this->user) === false) {
return false; // return false;
// Administrateur, toutes les permissions // Administrateur, toutes les permissions
} elseif ($this->getUser('group') === self::GROUP_ADMIN) { //} elseif ($this->getUser('group') === self::GROUP_ADMIN) {
return true; // return true;
// Groupe sans autorisation // Groupe sans autorisation
} elseif ($this->getUser('group') < 1) { //} elseif ($this->getUser('group') < 1) {
return false; // return false;
// Groupe avec profil, consultation des autorisations sur deux clés // Groupe avec profil, consultation des autorisations sur deux clés
} elseif ( //} elseif (
$key2 if ($key1
&& $key2
&& $this->user
&& $this->getData(['profil', $this->user['group'], $this->user['profil'], $key1]) && $this->getData(['profil', $this->user['group'], $this->user['profil'], $key1])
&& array_key_exists($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]); return $this->getData(['profil', $this->user['group'], $this->user['profil'], $key1, $key2]);
// Groupe avec profil, consultation des autorisations sur une seule clé // Groupe avec profil, consultation des autorisations sur une seule clé
} elseif ( } elseif (
$this->getData(['profil', $this->user['group'], $this->user['profil']]) $key1
&& $this->user
&& $this->getData(['profil', $this->user['group'], $this->user['profil']])
&& array_key_exists($key1, $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]); return $this->getData(['profil', $this->user['group'], $this->user['profil'], $key1]);