- Rechteprüfung auf .some(r => r.IdRight === 56) umgestellt - Bug in PoiUpdateModal behoben (falscher fetchLocationDevices Import) - Modal öffnet sich nur mit gültigem Bearbeitungsrecht - Version auf 1.1.159 erhöht
28 lines
941 B
JavaScript
28 lines
941 B
JavaScript
// /services/webservice/fetchUserRightsService.js
|
|
export const fetchUserRightsService = async () => {
|
|
const mode = process.env.NEXT_PUBLIC_API_PORT_MODE;
|
|
const apiBaseUrl = mode === "dev" ? `${window.location.protocol}//${window.location.hostname}:80/talas5/ClientData/WebServiceMap.asmx` : `${window.location.origin}/talas5/ClientData/WebServiceMap.asmx`;
|
|
|
|
const params = new URLSearchParams(window.location.search);
|
|
const idMap = params.get("m");
|
|
const idUser = params.get("u");
|
|
|
|
const url = `${apiBaseUrl}/GisSystemStatic?idMap=${idMap}&idUser=${idUser}`;
|
|
console.log("🔍 Rechte-Fetch URL:", url);
|
|
|
|
const response = await fetch(url, {
|
|
method: "GET",
|
|
headers: {
|
|
Connection: "close",
|
|
},
|
|
});
|
|
|
|
if (!response.ok) {
|
|
throw new Error("Fehler beim Abrufen der Benutzerrechte");
|
|
}
|
|
|
|
const json = await response.json();
|
|
console.log("👤 Rechte-Response JSON:", json);
|
|
return json.Rights || [];
|
|
};
|