POIs visible with checkbox

This commit is contained in:
ISA
2024-05-30 09:35:16 +02:00
parent ee0118244b
commit 79321ac06d
8 changed files with 276 additions and 22 deletions

View File

@@ -1,8 +1,8 @@
// pages/api/readPoiTyp.js
import mysql from 'mysql';
import mysql from "mysql";
const pool = mysql.createPool({
connectionLimit: 10,
//connectionLimit: 10,
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASSWORD,
@@ -13,7 +13,7 @@ const pool = mysql.createPool({
export default function handler(req, res) {
if (req.method === "GET") {
const query = "SELECT * FROM poityp";
pool.query(query, (error, results) => {
if (error) {
console.error("Fehler beim Abfragen der Datenbank:", error);

29
pages/api/rights.js Normal file
View File

@@ -0,0 +1,29 @@
// pages/api/rights.js
export default function handler(req, res) {
const { idMap, idUser } = req.query;
// Beispielhafte Rechte, die je nach idMap und idUser variieren können
const rights = {
'10': [
{ IdRight: 1, Name: "Zugriff auf Dashboard" },
{ IdRight: 56, Name: "Erweiterte Berechtigungen" }
],
'2': [
{ IdRight: 2, Name: "Zugriff auf Einstellungen" }
],
'1': [
{ IdRight: 10, Name: "Admin-Zugriff" },
{ IdRight: 11, Name: "Zugriff auf alle Daten" }
]
};
// Prüfung, ob eine gültige idMap und idUser vorhanden sind
if (rights[idMap] && idUser === '484') {
// Rückgabe der spezifischen Rechte basierend auf der idMap und idUser
res.status(200).json({ Rights: rights[idMap] });
} else {
// Rückgabe leerer Rechte für ungültige idMap oder andere Benutzer
res.status(200).json({ Rights: [] });
}
}