5.5 KiB
5.5 KiB
Migration Discrepancies - Backup vs Current Blueprint Structure
1. Missing Routes
Authentication/Profile Routes (Not in any blueprint)
/profile- User profile page/profile/change-password- Change password endpoint/profile/setup-2fa- Setup 2FA page/profile/enable-2fa- Enable 2FA endpoint/profile/disable-2fa- Disable 2FA endpoint/heartbeat- Session heartbeat endpoint
Customer API Routes (Missing from api_routes.py)
/api/customer/<int:customer_id>/licenses- Get licenses for a customer/api/customer/<int:customer_id>/quick-stats- Get quick stats for a customer
Resource Routes (Missing from resource_routes.py)
/resources- Main resources page/resources/add- Add new resources page/resources/quarantine/<int:resource_id>- Quarantine a resource/resources/release- Release resources from quarantine/resources/history/<int:resource_id>- View resource history/resources/metrics- Resource metrics page/resources/report- Resource report page
Main Dashboard Route (Missing)
/- Main dashboard (currently in backup shows dashboard with stats)
2. Database Column Discrepancies
Column Name Differences
- created_by - Used in backup_history table but not consistently referenced
- is_test_license vs is_test - The database uses
is_testbut some code might referenceis_test_license
Session Table Aliases
The sessions table has multiple column aliases that need to be handled:
login_time(alias forstarted_at)last_activity(alias forlast_heartbeat)logout_time(alias forended_at)active(alias foris_active)
3. Template Name Mismatches
Templates Referenced in Backup
login.html- Login pageverify_2fa.html- 2FA verificationprofile.html- User profilesetup_2fa.html- 2FA setupbackup_codes.html- 2FA backup codesdashboard.html- Main dashboardindex.html- Create license formbatch_result.html- Batch operation resultsbatch_form.html- Batch formedit_license.html- Edit licenseedit_customer.html- Edit customercreate_customer.html- Create customercustomers_licenses.html- Customer-license overviewsessions.html- Sessions listaudit_log.html- Audit logbackups.html- Backup managementblocked_ips.html- Blocked IPsresources.html- Resources listadd_resources.html- Add resources formresource_history.html- Resource historyresource_metrics.html- Resource metricsresource_report.html- Resource report
4. URL_FOR References That Need Blueprint Prefixes
In Templates and Redirects
url_for('login')→url_for('auth.login')url_for('logout')→url_for('auth.logout')url_for('verify_2fa')→url_for('auth.verify_2fa')url_for('profile')→url_for('auth.profile')(needs implementation)url_for('index')→url_for('main.index')or appropriate blueprinturl_for('blocked_ips')→url_for('admin.blocked_ips')url_for('audit_log')→url_for('admin.audit_log')url_for('backups')→url_for('admin.backups')
5. Missing Functions/Middleware
Authentication Decorators
@login_requireddecorator implementation needs to be verified@require_2fadecorator (if used)
Helper Functions
get_connection()- Database connection helperlog_audit()- Audit logging functioncreate_backup()- Backup creation function- Rate limiting functions for login attempts
Session Management
- Session timeout handling
- Heartbeat mechanism for active sessions
6. API Endpoint Inconsistencies
URL Prefix Issues
- API routes in backup don't use
/apiprefix consistently - Some use
/api/...while others are at root level
Missing API Endpoints
/api/generate-license-key- Generate license key/api/global-search- Global search functionality
7. Export Routes Organization
Current vs Expected
- Export routes might need different URL structure
- Check if all export types are covered:
/export/licenses/export/audit/export/customers/export/sessions/export/resources
8. Special Configurations
Missing Configurations
- TOTP/2FA configuration
- Backup encryption settings
- Rate limiting configuration
- Session timeout settings
Environment Variables
- Check if all required environment variables are properly loaded
- Database connection parameters
- Secret keys and encryption keys
9. JavaScript/AJAX Endpoints
API calls that might be broken
- Device management endpoints
- Quick edit functionality
- Bulk operations
- Resource allocation checks
10. Permission/Access Control
Missing or Incorrect Access Control
- All routes need
@login_requireddecorator - Some routes might need additional permission checks
- API routes need proper authentication
Action Items
- Implement missing profile/auth routes in auth_routes.py
- Add missing customer API routes to api_routes.py
- Create complete resource management blueprint with all routes
- Fix main dashboard route - decide which blueprint should handle "/"
- Update all url_for() calls in templates to use blueprint prefixes
- Verify database column names are consistent throughout
- Check template names match between routes and actual files
- Implement heartbeat mechanism for session management
- Add missing helper functions to appropriate modules
- Test all export routes work correctly with new structure