From 797310c5ffa8d01a5ce7839b5bf7006fea7007cf Mon Sep 17 00:00:00 2001 From: aschwarz Date: Tue, 28 Mar 2023 13:52:53 +0200 Subject: [PATCH] Rollen/Rechte --- controller/admin_rollen.php | 24 +++++--- js/components/admin_rollen.js | 56 ++++++------------- templates/modern/dashboard/rollen.html | 1 + ...621b910340c1aee6ae0_0.file.rollen.html.php | 10 ++-- todo.txt | 3 +- 5 files changed, 41 insertions(+), 53 deletions(-) diff --git a/controller/admin_rollen.php b/controller/admin_rollen.php index 54871f2..a2021ad 100644 --- a/controller/admin_rollen.php +++ b/controller/admin_rollen.php @@ -106,20 +106,26 @@ if ($function == 'deluser') { } } -/* -if ($function == 'delete') { - $tabelle = $_POST['tabelle']; - $spalte = $_POST['spalte']; - $id = $_POST['id']; - $stmt = $db->query("DELETE FROM $tabelle WHERE $spalte = $id"); - if ($stmt) { - echo "success: DELETE FROM $tabelle WHERE $spalte = $id"; +if ($function == 'delRole') { + if (isset($_POST['rid'])) { + $rid = $_POST['rid']; + } + + $stmt1 = $db->query("DELETE FROM jumi_admin_rollen_rechte_zuord WHERE rid= $rid"); + $stmt2 = $db->query("DELETE FROM jumi_admin_rollen_user_zuord WHERE rid= $rid"); + $stmt3 = $db->query("DELETE FROM jumi_admin_rolle WHERE rid= $rid"); + if ($stmt1 AND $stmt2 AND $stmt3) { + echo '
Die Rolle wurde gelöscht!
|***|success'; + exit; } else { - echo "error: DELETE FROM $tabelle WHERE $spalte = $id"; + echo '
Die Rolle wurde nicht gelöscht: DELETE Fehler Datenbank.
|***|error'; + exit; } } +/* + if ($function == 'deleteQuestion') { $id2 = $_POST['id2']; diff --git a/js/components/admin_rollen.js b/js/components/admin_rollen.js index c810478..4db45fb 100644 --- a/js/components/admin_rollen.js +++ b/js/components/admin_rollen.js @@ -90,7 +90,7 @@ function delzuordnung(val) { }); }); } - $('#msg').show().delay(20000).fadeOut(500); + $('#msg').show().delay(10000).fadeOut(500); $('#msg').html(a[0]); } }, @@ -165,7 +165,7 @@ function deluser(val) { }); }); } - $('#msg').show().delay(20000).fadeOut(500); + $('#msg').show().delay(10000).fadeOut(500); $('#msg').html(a[0]); } }, @@ -176,26 +176,28 @@ function deluser(val) { } -/* -function onClickDelete(id) { - - document.getElementById("antwort").value = ""; - r = confirm('Antwort löschen?'); +function delRole(rid) { + r = confirm('Rolle löschen? Benutzer sind dann unzugeordnet!'); if (r) { $.ajax({ type: 'POST', - url: '../controller/admin_erfassen.php', + url: '../controller/admin_rollen.php', data: { - 'function': 'delete', - 'tabelle': 'jumi_umfragen_antworten', - 'spalte': 'uaid', - 'id': id + 'function': 'delRole', + 'rid': rid }, success: function(result) { //we got the response - $(document).ajaxStop(function(){ - window.location = "?action=fragen&erfassen=1"; - }); + if(result!=''){ + var a = result.split('|***|'); + if(a[1]=="success"){ + $(document).ajaxStop(function(){ + window.location = "?"; + }); + } + $('#msg').show().delay(10000).fadeOut(500); + $('#msg').html(a[0]); + } }, error: function(xhr, status, exception) { console.log(xhr); @@ -203,27 +205,3 @@ function onClickDelete(id) { }); } } - -function onClickDeleteQuestion(id2) { - document.getElementById("frage").value = ""; - document.getElementById("antwort").value = ""; - r = confirm('Gesamte Frage löschen?'); - if (r) { - $.ajax({ - type: 'POST', - url: '../controller/admin_erfassen.php', - data: { - 'function': 'deleteQuestion', - 'id2': id2 - }, - success: function(result) { - // document.getElementById("del").innerHTML = "entfernt"; - //Text einblenden geht nicht, da ein Refresh gemacht wird. Dann sieht man den Text nicht - $(document).ajaxStop(function(){ - window.location = "?action=fragen&erfassen=1"; - }); - } - }); - } -} -*/ \ No newline at end of file diff --git a/templates/modern/dashboard/rollen.html b/templates/modern/dashboard/rollen.html index a939b7e..fc52202 100644 --- a/templates/modern/dashboard/rollen.html +++ b/templates/modern/dashboard/rollen.html @@ -102,6 +102,7 @@ $(document).ready(function(){
+
diff --git a/templates_c/5e39749cb1a64f7b81c95621b910340c1aee6ae0_0.file.rollen.html.php b/templates_c/5e39749cb1a64f7b81c95621b910340c1aee6ae0_0.file.rollen.html.php index 715cd7e..ae467a0 100644 --- a/templates_c/5e39749cb1a64f7b81c95621b910340c1aee6ae0_0.file.rollen.html.php +++ b/templates_c/5e39749cb1a64f7b81c95621b910340c1aee6ae0_0.file.rollen.html.php @@ -1,18 +1,18 @@ _decodeProperties($_smarty_tpl, array ( 'version' => '3.1.39', - 'unifunc' => 'content_6422c6426320c9_55428832', + 'unifunc' => 'content_6422cf77bc2191_44742864', 'has_nocache_code' => false, 'file_dependency' => array ( '5e39749cb1a64f7b81c95621b910340c1aee6ae0' => array ( 0 => 'F:\\git\\survey\\templates\\modern\\dashboard\\rollen.html', - 1 => 1680000576, + 1 => 1680002934, 2 => 'file', ), ), @@ -20,7 +20,7 @@ if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array ( array ( ), ),false)) { -function content_6422c6426320c9_55428832 (Smarty_Internal_Template $_smarty_tpl) { +function content_6422cf77bc2191_44742864 (Smarty_Internal_Template $_smarty_tpl) { if ($_smarty_tpl->tpl_vars['action']->value == '') {?> @@ -154,6 +154,8 @@ for ($__section_table_data_0_iteration = 1, $_smarty_tpl->tpl_vars['__smarty_sec |rollenzuordnung.php" onclick="ShowZuordnung(this)" data-bs-target="#ZuordnungModal"> + diff --git a/todo.txt b/todo.txt index 72d2b5a..7170874 100644 --- a/todo.txt +++ b/todo.txt @@ -5,8 +5,9 @@ todo -- Menü in Datenbank übernommen -- unlock im Login berücksichtigen -- Rechte einbauen +-- Rechteverwaltung -Rechteverwaltung +Rolle löschen Erfolgstext zu schnell Kacheln Startseite Passwortvorschau Fragen erfassen Probleme