From df4a56da49e6a74c74ad79e00fa542a82a983d09 Mon Sep 17 00:00:00 2001 From: Rodolphe Quiedeville Date: Fri, 3 Dec 2004 11:47:10 +0000 Subject: [PATCH] =?UTF-8?q?Adaptation=20au=20nouveau=20syst=E8me=20de=20pe?= =?UTF-8?q?rmissions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/DolibarrModules.class.php | 44 ++++++++++++++----- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/htdocs/includes/modules/DolibarrModules.class.php b/htdocs/includes/modules/DolibarrModules.class.php index f33635bb88f..60121df5a37 100644 --- a/htdocs/includes/modules/DolibarrModules.class.php +++ b/htdocs/includes/modules/DolibarrModules.class.php @@ -140,18 +140,40 @@ class DolibarrModules { foreach ($this->rights as $key => $value) { - $r_id = $this->rights[$key][0]; - $r_desc = $this->rights[$key][1]; - $r_type = $this->rights[$key][2]; - $r_def = $this->rights[$key][3]; - $r_modul = $this->rights_class; - + $r_id = $this->rights[$key][0]; + $r_desc = $this->rights[$key][1]; + $r_type = $this->rights[$key][2]; + $r_def = $this->rights[$key][3]; + $r_perms = $this->rights[$key][4]; + $r_subperms = $this->rights[$key][5]; + $r_modul = $this->rights_class; + + if (strlen($r_perms) ) + { + if (strlen($r_subperms) ) + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def "; + $sql .= " (id, libelle, module, type, bydefault, perms, subperms)"; + $sql .= " VALUES "; + $sql .= "(".$r_id.",'".$r_desc."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."','".$r_subperms."');"; + } + else + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def "; + $sql .= " (id, libelle, module, type, bydefault, perms)"; + $sql .= " VALUES "; + $sql .= "(".$r_id.",'".$r_desc."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."');"; + } + } + else + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def "; + $sql .= " (id, libelle, module, type, bydefault)"; + $sql .= " VALUES "; + $sql .= "(".$r_id.",'".$r_desc."','".$r_modul."','".$r_type."',".$r_def.");"; + } + - $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def "; - $sql .= " (id, libelle, module, type, bydefault)"; - $sql .= " VALUES "; - $sql .= "(".$r_id.",'".$r_desc."','".$r_modul."','".$r_type."',".$r_def.");"; - if ( $this->db->query($sql) ) { }