Login nur fuer Mitarbeiter (Label), Kunden-Konten werden abgewiesen

Kunden haben Konten im selben Appwrite-Projekt und konnten sich mit ihrem
Portal-Passwort im Ticketsystem anmelden; dabei entstand sogar automatisch ein
employees-Eintrag.

- lib/staffAccess.js: Zugang nur mit Label "mitarbeiter" oder "admin"
- AuthContext: Konto ohne Label -> Sitzung sofort beenden, Hinweis aufs
  Kundenportal (Login, Neuladen, nach dem 2FA-Code); employees-Eintrag nur
  noch fuer Mitarbeiter
- setup-legal.mjs: Rechte nur fuer die Labels (ein erneuter Lauf oeffnet
  nichts mehr fuer "users")

Die eigentliche Sperre sind die Appwrite-Rechte (Kundenportal
scripts/mitarbeiter-zugang.mjs --rechte).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-10-03 10:54:16 +00:00
1 parent 65e9931f2c
commit 78bc99a73b
5 files changed
+87 -6

No files matched your search

+5 -3
View File
@@ -11,6 +11,7 @@
*/
import { pathToFileURL } from "node:url";
import { staffPermissions } from "../src/lib/staffAccess.js";
const dryRun = process.argv.includes("--dry-run");
const endpoint = process.env.APPWRITE_ENDPOINT || "https://appwrite.webklar.com/v1";
@@ -18,8 +19,9 @@ const projectId = process.env.APPWRITE_PROJECT_ID || "6a1058610003c5a13a05";
const databaseId = process.env.APPWRITE_DATABASE_ID || "woms-database";
const apiKey = process.env.APPWRITE_API_KEY;
const READ_WRITE = ['read("users")', 'create("users")', 'update("users")'];
const CRUD = [...READ_WRITE, 'delete("users")'];
// Nur Mitarbeiter (Labels), nie "users": das waeren auch alle Kunden-Konten des Portals
const READ_WRITE = staffPermissions("read", "create", "update");
const CRUD = staffPermissions("read", "create", "update", "delete");
const date = (key) => ({ key, type: "string", size: 10 });
@@ -81,7 +83,7 @@ export const COLLECTIONS = [
export const BUCKET = {
id: "legal-files",
name: "Rechtliches Dateien",
perms: ['read("users")', 'create("users")'],
perms: staffPermissions("read", "create"),
maxSize: 20 * 1024 * 1024,
extensions: ["pdf", "html", "htm", "png", "jpg", "jpeg", "webp", "doc", "docx"],
};