- Fixed AdminController to extend OCP\AppFramework\Controller
- Annotations (@NoAdminRequired, @NoCSRFRequired) now work
- Proper parent::__construct() call
- Added test route /admin/test for debugging
- Returns JSON to confirm controller works
- Helps diagnose routing vs permission issues
- Simplified routes to essential ones only
- admin#index and admin#test
This should resolve 'Access forbidden' for system admin users.
The key fix was extending the proper Controller base class.
- Simplified AdminController to minimal version
- Removed complex dependency injection
- Added @NoAdminRequired and @NoCSRFRequired annotations
- Minimal constructor with just appName
- Simplified routes.php
- Removed requirements array
- Clean route definitions
- Fixed admin template
- Kept same UI but removed non-standard calls
- Self-contained CSS and simple form
- This addresses 'Access forbidden' error when accessing admin page
The issue was likely caused by:
1. Missing annotations on admin controller
2. Complex DI not working properly
3. Route configuration issues
Simplified version should resolve access issues.
- Created appinfo/Application.php (Nextcloud app bootstrap)
- Extends OCP\AppFramework\App
- Registers proper app ID: analyticshub
- Loads CSS and JS files
- Removed obsolete lib/App.php file
- Updated all AppInfo::APP_NAME references to Application::APP_NAME
- AdminController, ApiV1Controller
- GoogleAnalyticsService, LLMService
- Fixed dependency injection in AdminController
- Injected IConfig service properly
- Added missing use statements
This is the core fix for the app not appearing in Nextcloud.
Nextcloud requires appinfo/Application.php to initialize the app.
- Created appinfo/routes.php to register all routes
- Admin routes: index, save, load, getStatus
- API v1 routes: reports, getReport, generate, getStatus
- Report routes: index, generate
- Added index() method to AdminController
- Renders admin template via TemplateResponse
- Updated info.xml and appinfo/info.xml
- Fixed navigation entry to point to route: analyticshub.admin.index
- Added settings and navigation sections
- App now appears in Settings → Administration after enable/disable
Fixes issue where app didn't show up in Nextcloud toolbar after being enabled.
- Renamed analytics-hub/ → analyticshub/
- App ID in info.xml is 'analyticshub' (no hyphen)
- Nextcloud requires folder name to match app ID exactly
- Fixes 'Could not download app analyticshub' error during installation
Installation:
- Upload analyticshub/ folder to /var/www/nextcloud/apps/
- Folder name must match app ID in info.xml