From f28a590743dc985ae874c35f2102cd7607c4ab28 Mon Sep 17 00:00:00 2001 From: oesi Date: Wed, 17 Jan 2018 10:57:31 +0100 Subject: [PATCH] Neue Rollen werden automatisch angelegt wenn diese nicht vorhanden sind --- application/controllers/DBTools.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/application/controllers/DBTools.php b/application/controllers/DBTools.php index 0b4d77110..8590c2285 100644 --- a/application/controllers/DBTools.php +++ b/application/controllers/DBTools.php @@ -426,6 +426,29 @@ class DBTools extends FHC_Controller foreach ($this->config->item('roles') as $role) { echo "\n\n".'Check role '.$role['rolle_kurzbz']; + $qry = "SELECT * FROM system.tbl_rolle + WHERE rolle_kurzbz='".$role['rolle_kurzbz']."';"; + + if($result = $this->db->query($qry)) + { + if($result->num_rows($result)==0) + { + // Nicht vorhanden -> anlegen + $qry_insert="INSERT INTO system.tbl_rolle(rolle_kurzbz, beschreibung) VALUES ('".$role['rolle_kurzbz']."','".$role['rolle_kurzbz']."');"; + + if($this->db->query($qry_insert)) + { + echo "\nRolle ".$role['rolle_kurzbz'].' hinzugefügt'; + $neue=true; + } + else + { + echo "\nFehler: ".$role['rolle_kurzbz'].' Rolle hinzufügen nicht möglich'; + continue; + } + } + } + foreach ($role['berechtigung'] as $b) { $qry = "SELECT * FROM system.tbl_rolleberechtigung