feat(sharing): add file sharing and role-based access management

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/8091889d-4810-4794-b9d3-6b8f7f5257c4
This commit is contained in:
copilot-swe-agent[bot]
2026-03-22 14:14:50 +00:00
parent 83afc6c8f6
commit 6f2752bdf8
13 changed files with 1669 additions and 9 deletions
+9
View File
@@ -497,6 +497,14 @@ def file_annotations_page(request: Request, file_id: int, db: Session = Depends(
mime = file_record.mime_type or ""
is_pdf = mime == "application/pdf" or (file_record.original_filename or "").lower().endswith(".pdf")
# Determine the current user's role on this file
from app.utils.user_scope import get_current_owner_id, get_file_role
current_owner_id = get_current_owner_id(request)
user_session = request.session.get("user")
is_admin = isinstance(user_session, dict) and bool(user_session.get("is_admin"))
current_user_role = "owner" if is_admin else (get_file_role(file_record, current_owner_id, db) or "viewer")
return templates.TemplateResponse(
"file_annotations.html",
{
@@ -505,6 +513,7 @@ def file_annotations_page(request: Request, file_id: int, db: Session = Depends(
"original_file_exists": original_file_exists,
"processed_file_exists": processed_file_exists,
"is_pdf": is_pdf,
"current_user_role": current_user_role,
},
)
except Exception as e: