Rollen/Rechte

This commit is contained in:
aschwarz 2023-03-28 13:52:53 +02:00
parent 0b55c7d5cb
commit 797310c5ff
5 changed files with 41 additions and 53 deletions

View File

@ -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 '<div class="alert alert-success"><i class="fa fa-fw fa-thumbs-up"></i> Die Rolle wurde gelöscht!</div>|***|success';
exit;
} else {
echo "error: DELETE FROM $tabelle WHERE $spalte = $id";
echo '<div class="alert alert-danger"><i class="fa fa-fw fa-thumbs-down"></i> Die Rolle wurde nicht gelöscht: DELETE Fehler Datenbank.</div>|***|error';
exit;
}
}
/*
if ($function == 'deleteQuestion') {
$id2 = $_POST['id2'];

View File

@ -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 = "<strong>entfernt</strong>";
//Text einblenden geht nicht, da ein Refresh gemacht wird. Dann sieht man den Text nicht
$(document).ajaxStop(function(){
window.location = "?action=fragen&erfassen=1";
});
}
});
}
}
*/

View File

@ -102,6 +102,7 @@ $(document).ready(function(){
<div class="col-4 col-md-2">
<a class="btn btn-success btn-rounded btn-icon btn-sm" data-bs-toggle="modal" value="{$table_data[table_data].rid}|rollenzuordnung.php" onclick="ShowZuordnung(this)" data-bs-target="#ZuordnungModal"><i class="fa fa-eye" style="width:18px;"></i></a>
<a class="btn btn-success btn-rounded btn-icon btn-sm" data-bs-toggle="modal" value="{$table_data[table_data].rid}|userzuordnung.php" onclick="ShowZuordnung(this)" data-bs-target="#ZuordnungModal"><i class="fa fa-user" style="width:18px;"></i></a>
<a class="btn btn-danger btn-rounded btn-icon btn-sm" onclick="delRole({$table_data[table_data].rid})"><i class="fa fa-trash" style="width:18px;"></i></a>
</div>
</div>

View File

@ -1,18 +1,18 @@
<?php
/* Smarty version 3.1.39, created on 2023-03-28 12:49:38
/* Smarty version 3.1.39, created on 2023-03-28 13:28:55
from 'F:\git\survey\templates\modern\dashboard\rollen.html' */
/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_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 == '') {?>
<!doctype html>
<html lang="de">
@ -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"><i class="fa fa-eye" style="width:18px;"></i></a>
<a class="btn btn-success btn-rounded btn-icon btn-sm" data-bs-toggle="modal" value="<?php echo $_smarty_tpl->tpl_vars['table_data']->value[(isset($_smarty_tpl->tpl_vars['__smarty_section_table_data']->value['index']) ? $_smarty_tpl->tpl_vars['__smarty_section_table_data']->value['index'] : null)]['rid'];?>
|userzuordnung.php" onclick="ShowZuordnung(this)" data-bs-target="#ZuordnungModal"><i class="fa fa-user" style="width:18px;"></i></a>
<a class="btn btn-danger btn-rounded btn-icon btn-sm" onclick="delRole(<?php echo $_smarty_tpl->tpl_vars['table_data']->value[(isset($_smarty_tpl->tpl_vars['__smarty_section_table_data']->value['index']) ? $_smarty_tpl->tpl_vars['__smarty_section_table_data']->value['index'] : null)]['rid'];?>
)"><i class="fa fa-trash" style="width:18px;"></i></a>
</div>
</div>

View File

@ -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