felixrupp / user_cas

This app provides CAS authentication support for ownCloud and Nextcloud, using the phpCAS library of jasig/apereo.
Other
21 stars 24 forks source link

user_cas not working with nextcloud #112

Open hamradio123 opened 1 year ago

hamradio123 commented 1 year ago

user_cas not working with nextcloud

As long as the user_cas app is installed and enabled, I cannot access the security tab any more and the server throws an internal server error.

here is the output of the data/nextcloud.log

{"reqId":"CkjAeE4EGEiXDIPk1qXk","level":3,"time":"2023-05-31T06:53:41+00:00","remoteAddr":"10.0.2.2","user":"admin","app":"no app in context","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"App user_cas threw an error during app.php load: Class \"OCP\App\" not found","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0","version":"26.0.2.1","exception":{"Exception":"Error","Message":"Class \"OCP\App\" not found","Code":0,"Trace":[{"file":"/var/www/html/lib/private/legacy/OC_App.php","line":316,"function":"require_once"},{"file":"/var/www/html/lib/private/legacy/OC_App.php","line":192,"function":"requireAppFile","class":"OC_App","type":"::"},{"file":"/var/www/html/lib/private/legacy/OC_App.php","line":141,"function":"loadApp","class":"OC_App","type":"::"},{"file":"/var/www/html/lib/private/legacy/OC_User.php","line":128,"function":"loadApps","class":"OC_App","type":"::"},{"file":"/var/www/html/lib/base.php","line":760,"function":"setupBackends","class":"OC_User","type":"::"},{"file":"/var/www/html/lib/base.php","line":1167,"function":"init","class":"OC","type":"::"},{"file":"/var/www/html/ocs/v1.php","line":31,"args":["/var/www/html/lib/base.php"],"function":"require_once"},{"file":"/var/www/html/ocs/v2.php","line":23,"args":["/var/www/html/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/html/apps/user_cas/appinfo/app.php","Line":34,"message":"App user_cas threw an error during app.php load: Class \"OCP\App\" not found","CustomMessage":"App user_cas threw an error during app.php load: Class \"OCP\App\" not found"}}

washidepl commented 1 year ago

have you managed this?

liudonghua123 commented 6 months ago

I have the similar issue when using this app on nextcloud 29.0.1.

{"reqId":"AprnwrMxqFy2oJi8AGhl","level":3,"time":"2024-06-03T02:45:10+00:00","remoteAddr":"113.55.127.140","user":"admin","app":"no app in context","method":"GET","url":"/ocs/v2.php/apps/notifications/api/v2/notifications","message":"App user_cas threw an error during app.php load: Class \"OCP\\App\" not found","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 uacq","version":"29.0.1.1","exception":{"Exception":"Error","Message":"Class \"OCP\\App\" not found","Code":0,"Trace":[{"file":"/var/www/html/lib/private/App/AppManager.php","line":525,"function":"require_once"},{"file":"/var/www/html/lib/private/App/AppManager.php","line":416,"function":"requireAppFile","class":"OC\\App\\AppManager","type":"::","args":[["OCA\\UserCAS\\AppInfo\\Application"]]},{"file":"/var/www/html/lib/private/App/AppManager.php","line":216,"function":"loadApp","class":"OC\\App\\AppManager","type":"->","args":["user_cas"]},{"file":"/var/www/html/lib/private/legacy/OC_App.php","line":128,"function":"loadApps","class":"OC\\App\\AppManager","type":"->","args":[["prelogin"]]},{"file":"/var/www/html/lib/private/legacy/OC_User.php","line":132,"function":"loadApps","class":"OC_App","type":"::","args":[["prelogin"]]},{"file":"/var/www/html/lib/base.php","line":776,"function":"setupBackends","class":"OC_User","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":1181,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/ocs/v1.php","line":31,"args":["/var/www/html/lib/base.php"],"function":"require_once"},{"file":"/var/www/html/ocs/v2.php","line":23,"args":["/var/www/html/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/html/custom_apps/user_cas/appinfo/app.php","Line":34,"message":"App user_cas threw an error during app.php load: Class \"OCP\\App\" not found","exception":{},"CustomMessage":"App user_cas threw an error during app.php load: Class \"OCP\\App\" not found"}}
{"reqId":"tue5r3icVDxRR6cxjgXW","level":3,"time":"2024-06-03T02:45:26+00:00","remoteAddr":"113.55.127.140","user":"admin","app":"no app in context","method":"PUT","url":"/ocs/v2.php/apps/user_status/api/v1/heartbeat?format=json","message":"App user_cas threw an error during app.php load: Class \"OCP\\App\" not found","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 uacq","version":"29.0.1.1","exception":{"Exception":"Error","Message":"Class \"OCP\\App\" not found","Code":0,"Trace":[{"file":"/var/www/html/lib/private/App/AppManager.php","line":525,"function":"require_once"},{"file":"/var/www/html/lib/private/App/AppManager.php","line":416,"function":"requireAppFile","class":"OC\\App\\AppManager","type":"::","args":[["OCA\\UserCAS\\AppInfo\\Application"]]},{"file":"/var/www/html/lib/private/App/AppManager.php","line":216,"function":"loadApp","class":"OC\\App\\AppManager","type":"->","args":["user_cas"]},{"file":"/var/www/html/lib/private/legacy/OC_App.php","line":128,"function":"loadApps","class":"OC\\App\\AppManager","type":"->","args":[["prelogin"]]},{"file":"/var/www/html/lib/private/legacy/OC_User.php","line":132,"function":"loadApps","class":"OC_App","type":"::","args":[["prelogin"]]},{"file":"/var/www/html/lib/base.php","line":776,"function":"setupBackends","class":"OC_User","type":"::","args":[]},{"file":"/var/www/html/lib/base.php","line":1181,"function":"init","class":"OC","type":"::","args":[]},{"file":"/var/www/html/ocs/v1.php","line":31,"args":["/var/www/html/lib/base.php"],"function":"require_once"},{"file":"/var/www/html/ocs/v2.php","line":23,"args":["/var/www/html/ocs/v1.php"],"function":"require_once"}],"File":"/var/www/html/custom_apps/user_cas/appinfo/app.php","Line":34,"message":"App user_cas threw an error during app.php load: Class \"OCP\\App\" not found","exception":{},"CustomMessage":"App user_cas threw an error during app.php load: Class \"OCP\\App\" not found"}}
liudonghua123 commented 6 months ago

I tried the followings to make it work for me.

  1. search and replace \OCP\App to \OC_App. Two files:
  2. remove or update \OC_App::isEnabled and \OC_App::getAppInfo api, I couldn't find the alternative api, and I found it's safe to remove it, so I just removed.

Only two files (custom_apps/user_cas/appinfo/app.php and custom_apps/user_cas/templates/admin.php) need to change.

image

image

image