faiss_rag_enterprise/scripts/permissions.py

12 lines
356 B
Python

import json
PERMISSION_PATH = "scripts/index_permissions.json"
def get_user_allowed_indexes(user_id: str):
try:
with open(PERMISSION_PATH, "r", encoding="utf-8") as f:
permission_map = json.load(f)
return permission_map.get(user_id, [])
except Exception as e:
print(f"[Permission Error] {e}")
return []