suna/backend/core/utils
marko-kraemer ddf2d32f59 feat(admin): add user thread viewer with admin access bypass
 Features:
- Add admin portal thread viewer with pagination
- Display thread list with project names and public status
- Add clickable links to view threads via /share/{thread_id}
- Add admin bypass for accessing all threads (public and private)

🔧 Backend Refactoring:
- Consolidate admin APIs into admin_api.py and billing_admin_api.py
- Remove unused files: users_admin.py, admin/api.py
- Remove unused endpoints: user search, grant-bulk-credits, migrate-user
- Update admin thread endpoint to use share URLs

 Performance:
- Remove message_count from UserThreadSummary (optimization)
- Remove N+1 query issue in thread listing

🔒 Authorization:
- Add admin role bypass in verify_and_authorize_thread_access
- Create RLS migration (20251005160000_admin_roles_access.sql)
- Update thread_select_policy for admin access
- Update message_select_policy for admin access
- Update project_select_policy for admin access
- Update agent_runs_select_policy for admin access

💻 Frontend:
- Add Threads tab to admin user details dialog
- Add useAdminUserThreads hook with pagination
- Remove unused admin hooks (useAdminUserSearch, useAdminAdvancedSearch)
- Display thread metadata with Open button and ExternalLink icon

🗃️ Database:
- Apply RLS policies allowing admin/super_admin roles to bypass restrictions
- Admins can now view any thread, message, project, or agent_run

This enables admins to view and debug any user's threads through the
share page interface, regardless of public/private status.
2025-10-05 18:09:26 +02:00
..
scripts refactor: remove deprecated code and endpoints 2025-10-04 22:45:41 +02:00
__init__.py mv around files, update imports 2025-09-03 22:40:25 -07:00
auth_utils.py feat(admin): add user thread viewer with admin access bypass 2025-10-05 18:09:26 +02:00
cache.py mv around files, update imports 2025-09-03 22:40:25 -07:00
config.py model changes 2025-09-28 23:36:14 +02:00
core_tools_helper.py chore: granular control of tools 2025-09-26 14:49:12 +05:30
db_helpers.py refactor: simplify backend - fix naming conflicts and centralize DB dependencies 2025-10-04 22:40:16 +02:00
encryption.py feat(admin): add user thread viewer with admin access bypass 2025-10-05 18:09:26 +02:00
files_utils.py mv around files, update imports 2025-09-03 22:40:25 -07:00
icon_generator.py refactor: completely remove workflow and playbook system 2025-10-05 01:51:44 +02:00
json_helpers.py mv around files, update imports 2025-09-03 22:40:25 -07:00
limits_checker.py refactor: massive backend simplification - eliminate 450+ lines of duplicate code 2025-10-04 22:32:51 +02:00
logger.py wip 2025-09-19 12:25:48 +02:00
mcp_helpers.py refactor: massive backend simplification - eliminate 450+ lines of duplicate code 2025-10-04 22:32:51 +02:00
pagination.py mv around files, update imports 2025-09-03 22:40:25 -07:00
project_helpers.py refactor: massive backend simplification - eliminate 450+ lines of duplicate code 2025-10-04 22:32:51 +02:00
query_utils.py mv around files, update imports 2025-09-03 22:40:25 -07:00
retry.py mv around files, update imports 2025-09-03 22:40:25 -07:00
run_management.py refactor: massive backend simplification - eliminate 450+ lines of duplicate code 2025-10-04 22:32:51 +02:00
s3_upload_utils.py wip 2025-09-17 19:23:20 +02:00
suna_default_agent_service.py mv around files, update imports 2025-09-03 22:40:25 -07:00
tool_groups.py refactor: completely remove workflow and playbook system 2025-10-05 01:51:44 +02:00
tool_migration.py chore: granular control of tools 2025-09-26 14:49:12 +05:30