fix: ready for merge with int

This commit is contained in:
Ida Dittrich 2026-02-26 16:17:15 +01:00
parent 15fe598073
commit 1e4047caf1
2 changed files with 6 additions and 22 deletions

View file

@ -1206,20 +1206,14 @@ class ComponentObjects:
return False
def getFileData(self, fileId: str) -> Optional[bytes]:
"""Returns the binary data of a file if user has access.
File access is user-scoped (same as routeDataFiles): getFile() verifies the user
owns the FileItem via _createdBy. Once ownership is confirmed, we read FileData
directly to ensure the uploader can always access their file content.
"""
# Check file access (user-scoped via _createdBy - same logic as routeDataFiles)
"""Returns the binary data of a file if user has access."""
# Check file access
file = self.getFile(fileId)
if not file:
logger.warning(f"No access to file ID {fileId}")
return None
# User owns the file - read FileData directly (bypass RBAC for owned files)
fileDataEntries = self.db.getRecordset(FileData, recordFilter={"id": fileId})
fileDataEntries = getRecordsetWithRBAC(self.db, FileData, self.currentUser, recordFilter={"id": fileId}, mandateId=self.mandateId)
if not fileDataEntries:
logger.warning(f"No data found for file ID {fileId}")
return None

View file

@ -36,15 +36,6 @@ def discoverFeatureContainers() -> List[str]:
return sorted(containers)
def _router_load_order_key(filepath: str) -> tuple:
"""
Sort key for router loading. Longer/lexicographically later prefixes first
so that more specific routes (e.g. /api/chatplayground) register before generic ones.
"""
featureDir = os.path.basename(os.path.dirname(filepath))
return (-len(featureDir), featureDir)
def loadFeatureRouters(app: FastAPI) -> Dict[str, Any]:
"""
Dynamically load and register routers from all discovered feature containers.
@ -57,9 +48,8 @@ def loadFeatureRouters(app: FastAPI) -> Dict[str, Any]:
"""
results = {}
pattern = os.path.join(FEATURES_DIR, "*", "routeFeature*.py")
filepaths = sorted(glob.glob(pattern), key=_router_load_order_key)
for filepath in filepaths:
for filepath in glob.glob(pattern):
featureDir = os.path.basename(os.path.dirname(filepath))
routerFile = os.path.basename(filepath)[:-3] # Remove .py