jgraph/drawio-nextcloud

Enable admin delegation

Closed this issue · 3 comments

Is it possible to enable admin delegation (IDelegatedSettings) for this app?
we got the request from a customer

Could you expand on what this involves please?

See https://docs.nextcloud.com/server/latest/developer_manual/basics/setting.html:

Additionally since Nextcloud 23, groups can be granted authorization to access individual admin settings (see admin docs). This is a feature that needs to be enabled for each admin setting class. To do so, the setting class needs to implement IDelegatedSettings instead of ISettings and implement two additional methods.

<?php
namespace OCA\NotesTutorial\Settings;

use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\IL10N;
use OCP\Settings\IDelegatedSettings;

class NotesAdmin implements IDelegatedSettings {

    ...

    public function getName(): ?string {
        // This can also return an empty string in case there is only one setting
        // in the section.
        return $this->l->t('Notes Admin Settings');
    }

    public function getAuthorizedAppConfig(): array {
        return [
            // Allow a list of regex that the user can modify with this setting.
            'notes' => ['/notes_.*/', '/my_notes_setting/'],
        ];
    }
}

And so on. This affects lib/Settings/Admin.php.

I will provide a pull request for that - it was not very hard to implement.

The idea is, that you can select what user groups are allowed to access admin settings of an app. So when implemented, other groups can be allowed to access Draw.io admin settings, even if the users are not Nextcloud admins. The end result will then look like this:

image