Howto/Example for App Settings

Hi,

I am developing an app which needs to be configured, since it talks to another system.
So from this reading
https://docs.nextcloud.org/server/9/developer_manual/app/configuration.html
I understand that I need to use “App Values”.

Now my question is, how to create the UI part for configuring my app?
From OC 8 I remember that I needed to register Admin Settings. But obviously this has changed in version 9.
I absolutely did not find any more information about this.
It seems I need a Settings Controller? (https://github.com/nextcloud/user_saml/blob/master/appinfo/app.php)

Thanks a lot
Cornelius

Using the SettingsController approach is basically a workaround to allow unit tests on your registered settings page.

The recommended approach is:

  1. Register page using OCP\App::registerAdmin
  2. Create the registered file and reference your controller in it (can be named anyways): https://github.com/nextcloud/user_saml/blob/07a98d66f185f6164f010d1a506465c1632263a3/admin.php
  3. Create the controller, see https://docs.nextcloud.org/server/9/developer_manual/app/controllers.html on how to hook it up with your app container.
1 Like

Thanks for your response.

Obiviously I managed to register the page.
I referenced the controller, but for some reason it can not be found.
I get: Class 'OCP\\\\TwoFactor_privacyIDEA\\\\Controller\\\\SettingsController' not found.

{“reqId”:“QR/NswGj8jXjTZQ6HbLH”,“remoteAddr”:“172.16.200.106”,“app”:“index”,“message”:“Exception: {"Exception":"Error","Message":"Class ‘OCP\\TwoFactor_privacyIDEA\\Controller\\SettingsController’ not found","Code":0,"Trace":"#0 \/var\/www\/owncloud\/3rdparty\/pimple\/pimple\/src\/Pimple\/Container.php(113): OCA\\TwoFactor_privacyIDEA\\AppInfo\\Application->OCA\\TwoFactor_privacyIDEA\\AppInfo\\{closure}(Object(OC\\AppFramework\\DependencyInjection\\DIContainer))\n#1 \/var\/www\/owncloud\/lib\/private\/AppFramework\/Utility\/SimpleContainer.php(102): Pimple\\Container->offsetGet(‘SettingsControl…’)\n#2 \/var\/www\/owncloud\/apps\/twofactor_privacyidea\/admin.php(10): OC\\AppFramework\\Utility\\SimpleContainer->query(‘SettingsControl…’)\n#3 \/var\/www\/owncloud\/lib\/private\/legacy\/app.php(735): include(‘\/var\/www\/ownclo…’)\n#4 \/var\/www\/owncloud\/settings\/admin.php(176): OC_App::getForms(‘admin’)\n#5 \/var\/www\/owncloud\/lib\/private\/Route\/Route.php(154) : runtime-created function(1): require_once(‘\/var\/www\/ownclo…’)\n#6 [internal function]: __lambda_func()\n#7 \/var\/www\/owncloud\/lib\/private\/Route\/Router.php(280): call_user_func(‘\\x00lambda_425’, Array)\n#8 \/var\/www\/owncloud\/lib\/base.php(879): OC\\Route\\Router->match(‘\/settings\/admin’)\n#9 \/var\/www\/owncloud\/index.php(39): OC::handleRequest()\n#10 {main}","File":"\/var\/www\/owncloud\/apps\/twofactor_privacyidea\/lib\/AppInfo\/Application.php","Line":40}”,“level”:3,“time”:“2016-07-06T08:52:21+00:00”,“method”:“GET”,“url”:“/index.php/settings/admin”,“user”:“cornelius”}

What a shame - at the moment I am using OC9.1RC due to the 2FA API. But nevertheless this is simply the settings for an app…
https://github.com/privacyidea/owncloud_Nein_Won/tree/master/twofactor_privacyidea

Thanks a lot
Cornelius

Honestly I am disappointed. The documentation sucks and there is missing a simple howto to get someone started.

Dear nextcloud, please improve this!

Kind regards
Cornelius

1 Like