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';
if (array_key_exists($action, $module::$actions)
//&& $this->getPermission($moduleId, $action)
){
var_dump( $moduleId);
var_dump ($action);
var_dump ($this->getPermission('user', 'login'));
if (array_key_exists($action, $module::$actions)) {
$module->$action();
$output = $module->output;
// Check le groupe de l'utilisateur

View File

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