From 888b6c9b796257d5cb1bfc1d9092d36b3d2af085 Mon Sep 17 00:00:00 2001 From: jhartworks Date: Tue, 17 Nov 2026 13:40:23 +0100 Subject: [PATCH] fix: serialize native account form lists and refresh user grants --- CHANGELOG.md | 4 ++ symcon/NextFloor/form.json | 4 +- symcon/NextFloor/libs/Users.php | 32 +++++++++---- symcon/NextFloor/module.php | 4 +- symcon/README.md | 24 +++++++--- symcon/library.json | 6 +-- symcon/tests/users-form.php | 82 +++++++++++++++++++++++++++++++++ 7 files changed, 134 insertions(+), 22 deletions(-) create mode 100644 symcon/tests/users-form.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 163c6c6..af0fcc9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to NextFloor, newest first. Every release lists what is **Ad ## [Unreleased] +### Fixed + +- **Native account form (Symcon 0.3.2):** Serialize every row of Symcon's iterable form List variables before saving rights, fixing rejected or lost room/device/object grants. Move the password and reset action below the user name. Reload all three tables and their target choices on account changes, preserving missing plan targets for their owner and clearing password/new-user inputs. Correct the designer button and documentation: `link:` opens a browser, whereas IPSView's internal Pro Console tab is a dedicated console integration, not a general module API. + ### Added - **Hydronic status bindings (Symcon 0.3.1):** Add native object-tree status selection for individual heating/cooling circuits, every fresh-water cascade unit and the common plant. Floating cards and detail dialogs preserve formatted Integer aliases, including zero, live updates, unavailable values, archive access and scoped user permissions. Status readings remain read-only, hide unlinked rows and truncate long labels without widening cards; existing single stations retain their links when promoted to cascades. diff --git a/symcon/NextFloor/form.json b/symcon/NextFloor/form.json index 72a2480..08059c6 100644 --- a/symcon/NextFloor/form.json +++ b/symcon/NextFloor/form.json @@ -16,7 +16,7 @@ }, { "type": "Button", - "caption": "Designer in der Konsole öffnen", + "caption": "Designer im Browser öffnen", "onClick": "echo NFSC_OpenDesigner($id);", "link": true }, @@ -25,7 +25,7 @@ "caption": "Alle Anmeldungen beenden und Designer öffnen", "onClick": "echo NFSC_RotateAccessToken($id);", "link": true, - "confirm": "Alle Benutzer dieser Instanz werden abgemeldet. Der Konsolen-Designer wird anschließend neu geöffnet. Fortfahren?" + "confirm": "Alle Benutzer dieser Instanz werden abgemeldet. Der Designer wird anschließend im Browser neu geöffnet. Fortfahren?" } ], "status": [ diff --git a/symcon/NextFloor/libs/Users.php b/symcon/NextFloor/libs/Users.php index dab38c2..52c7894 100644 --- a/symcon/NextFloor/libs/Users.php +++ b/symcon/NextFloor/libs/Users.php @@ -12,17 +12,17 @@ trait NextFloorUsers $account = $this->accounts()[$id] ?? []; $catalog = $this->accessCatalog(); $level = ['type' => 'Select', 'options' => [['caption' => 'Nur ansehen', 'value' => 'view'], ['caption' => 'Ansehen und bedienen', 'value' => 'control']]]; - $grants = static function (string $name, string $caption, array $options, array $values) use ($level): array { - foreach ($values as $v) if (!in_array($v['target'], array_column($options, 'value'), true)) $options[] = ['caption' => '(Nicht mehr im Plan) ' . $v['target'], 'value' => $v['target']]; + $grants = function (string $name, string $caption, array $options, array $values): array { return ['type' => 'List', 'name' => $name, 'caption' => $caption, 'rowCount' => 5, 'add' => true, 'delete' => true, 'values' => $values, - 'columns' => [['name' => 'target', 'caption' => 'Freigabe', 'width' => 'auto', 'add' => '', 'edit' => ['type' => 'Select', 'options' => [['caption' => 'Bitte auswählen', 'value' => ''], ...$options]]], - ['name' => 'access', 'caption' => 'Recht', 'width' => '190px', 'add' => 'view', 'edit' => $level]]]; + 'columns' => $this->planGrantColumns($options, $values)]; }; $userForm = ['type' => 'ExpansionPanel', 'caption' => 'Benutzer und Zugriffsrechte', 'expanded' => true, 'items' => [ ['type' => 'ValidationTextBox', 'caption' => 'Direkter Zugang (an die Symcon-Adresse anhängen)', 'value' => '/hook/' . $this->hookPath() . '/', 'enabled' => false], ['type' => 'Button', 'caption' => 'Anmeldeseite öffnen', 'link' => true, 'onClick' => 'echo NFSC_OpenLogin($id);'], ['type' => 'Select', 'name' => 'AccountSelect', 'caption' => 'Benutzer auswählen', 'value' => $id, 'options' => $this->accountOptions(), 'onChange' => 'NFSC_SelectAccessUser($id, $AccountSelect);'], ['type' => 'ValidationTextBox', 'name' => 'AccountName', 'caption' => 'Benutzername', 'value' => $account['name'] ?? ''], + ['type' => 'PasswordTextBox', 'name' => 'AccountPassword', 'caption' => 'Neues Passwort (leer = bestehendes behalten)', 'value' => ''], + ['type' => 'Button', 'name' => 'AccountReset', 'caption' => 'Passwort zurücksetzen', 'enabled' => $id !== '', 'onClick' => 'echo NFSC_ResetUserPassword($id, $AccountSelect, $AccountPassword);'], ['type' => 'CheckBox', 'name' => 'AccountEnabled', 'caption' => 'Zugang aktiv', 'value' => $account['enabled'] ?? true], ['type' => 'Select', 'name' => 'AccountRole', 'caption' => 'Rolle', 'value' => $account['role'] ?? 'user', 'options' => [['caption' => 'Benutzer · Ansicht und freigegebene Bedienung', 'value' => 'user'], ['caption' => 'Admin · vollständiger Zugriff und Editor', 'value' => 'admin']]], ['type' => 'CheckBox', 'name' => 'AccountViewAll', 'caption' => 'Alle Zustände ansehen', 'value' => $account['view_all'] ?? false], @@ -32,12 +32,17 @@ trait NextFloorUsers ['type' => 'List', 'name' => 'AccountObjects', 'caption' => 'Weitere Symcon-Geräte / Datenpunkte (optional)', 'rowCount' => 4, 'add' => true, 'delete' => true, 'values' => $account['objects'] ?? [], 'columns' => [['name' => 'target', 'caption' => 'Objekt aus dem Objektbaum', 'width' => 'auto', 'add' => 0, 'edit' => ['type' => 'SelectObject']], ['name' => 'access', 'caption' => 'Recht', 'width' => '190px', 'add' => 'view', 'edit' => $level]]], - ['type' => 'PasswordTextBox', 'name' => 'AccountPassword', 'caption' => 'Neues Passwort (leer = bestehendes behalten)', 'value' => ''], - ['type' => 'Button', 'caption' => 'Benutzer speichern', 'onClick' => 'echo NFSC_SaveAccessUser($id, $AccountSelect, $AccountName, $AccountRole, $AccountEnabled, $AccountViewAll, $AccountControlAll, json_encode($AccountRooms), json_encode($AccountDevices), json_encode($AccountObjects), $AccountPassword);'], - ['type' => 'Button', 'name' => 'AccountReset', 'caption' => 'Passwort zurücksetzen', 'enabled' => $id !== '', 'onClick' => 'echo NFSC_ResetUserPassword($id, $AccountSelect, $AccountPassword);'], + ['type' => 'Button', 'caption' => 'Benutzer speichern', 'onClick' => [ + // Native List variables implement iteration/ArrayAccess; direct JSON encoding does not serialize their rows. + '$rooms = []; foreach ($AccountRooms as $row) { $rooms[] = ["target" => $row["target"], "access" => $row["access"]]; }', + '$devices = []; foreach ($AccountDevices as $row) { $devices[] = ["target" => $row["target"], "access" => $row["access"]]; }', + '$objects = []; foreach ($AccountObjects as $row) { $objects[] = ["target" => $row["target"], "access" => $row["access"]]; }', + 'echo NFSC_SaveAccessUser($id, $AccountSelect, $AccountName, $AccountRole, $AccountEnabled, $AccountViewAll, $AccountControlAll, json_encode($rooms), json_encode($devices), json_encode($objects), $AccountPassword);', + ]], ['type' => 'Button', 'name' => 'AccountRevoke', 'caption' => 'Benutzer abmelden', 'enabled' => $id !== '', 'onClick' => 'echo NFSC_RevokeUserSessions($id, $AccountSelect);'], ['type' => 'Button', 'name' => 'AccountDelete', 'caption' => 'Benutzer löschen', 'enabled' => $id !== '', 'confirm' => 'Diesen NextFloor-Benutzer einschließlich seiner Zugänge löschen?', 'onClick' => 'echo NFSC_DeleteAccessUser($id, $AccountSelect);'], ['type' => 'PopupButton', 'caption' => 'ⓘ Rechte und Passwörter', 'popup' => ['caption' => 'Zugriffsrechte', 'items' => [ + ['type' => 'Label', 'caption' => 'Die Auswahl eines Benutzers lädt dessen Einstellungen und alle drei Freigabetabellen. Änderungen werden erst durch Benutzer speichern übernommen; beim Wechsel werden nicht gespeicherte Eingaben verworfen. Das Passwortfeld wird bei jedem Wechsel geleert.'], ['type' => 'Label', 'caption' => 'Admins dürfen den Editor und alle Geräte verwenden. Die Benutzerverwaltung bleibt ausschließlich in der Symcon-Konfiguration.'], ['type' => 'Label', 'caption' => 'Alle Zustände ansehen ohne weitere Bedienfreigabe ist ein Zugang nur zum Lesen. Einzelne Raum- und Gerätefreigaben ergänzen diese Grundrechte. Ohne Freigabe bleibt das Gebäude sichtbar, seine Zustände werden nicht übertragen.'], ['type' => 'Label', 'caption' => 'Eine Raumfreigabe umfasst seine verknüpften Werte, Geräte im Raum und die zugeordneten Bereichskategorien. Gerätefreigaben gelten für deren verknüpfte Datenpunkte. Bei automatischen Gerätezuordnungen die benötigten Symcon-Objekte zusätzlich auswählen oder feste Verknüpfungen im Editor setzen.'], @@ -57,15 +62,26 @@ trait NextFloorUsers return $options; } + private function planGrantColumns(array $options, array $values): array + { + foreach ($values as $v) if (!in_array($v['target'], array_column($options, 'value'), true)) $options[] = ['caption' => '(Nicht mehr im Plan) ' . $v['target'], 'value' => $v['target']]; + return [['name' => 'target', 'caption' => 'Freigabe', 'width' => 'auto', 'add' => '', 'edit' => ['type' => 'Select', 'options' => [['caption' => 'Bitte auswählen', 'value' => ''], ...$options]]], + ['name' => 'access', 'caption' => 'Recht', 'width' => '190px', 'add' => 'view', 'edit' => ['type' => 'Select', 'options' => [['caption' => 'Nur ansehen', 'value' => 'view'], ['caption' => 'Ansehen und bedienen', 'value' => 'control']]]]]; + } + public function SelectAccessUser(string $UserID): void { $a = $this->accounts()[$UserID] ?? []; if (!$a) $UserID = ''; $this->WriteAttributeString('SelectedAccount', $UserID); + $catalog = $this->accessCatalog(); $this->UpdateFormField('AccountSelect', 'options', json_encode($this->accountOptions())); foreach (['AccountSelect' => $UserID, 'AccountName' => $a['name'] ?? '', 'AccountEnabled' => $a['enabled'] ?? true, 'AccountRole' => $a['role'] ?? 'user', 'AccountViewAll' => $a['view_all'] ?? false, 'AccountControlAll' => $a['control_all'] ?? false, 'AccountPassword' => ''] as $name => $value) $this->UpdateFormField($name, 'value', $value); - foreach (['AccountRooms' => 'rooms', 'AccountDevices' => 'devices', 'AccountObjects' => 'objects'] as $name => $key) $this->UpdateFormField($name, 'values', json_encode($a[$key] ?? [])); + foreach (['AccountRooms' => 'rooms', 'AccountDevices' => 'devices', 'AccountObjects' => 'objects'] as $name => $key) { + if ($key !== 'objects') $this->UpdateFormField($name, 'columns', json_encode($this->planGrantColumns($catalog[$key], $a[$key] ?? []))); + $this->UpdateFormField($name, 'values', json_encode($a[$key] ?? [])); + } foreach (['AccountReset', 'AccountRevoke', 'AccountDelete'] as $name) $this->UpdateFormField($name, 'enabled', $UserID !== ''); } diff --git a/symcon/NextFloor/module.php b/symcon/NextFloor/module.php index 97914a7..f94b113 100644 --- a/symcon/NextFloor/module.php +++ b/symcon/NextFloor/module.php @@ -10,7 +10,7 @@ require_once __DIR__ . '/libs/Permissions.php'; * NextFloor for IP-Symcon. * * One visualization instance owns a floor-plan project. Its protected WebHook serves the designer as - * a console tab and the same viewer in an HTML-SDK tile iframe. Admins receive the native object tree; + * a browser tab and the same viewer in an HTML-SDK tile iframe. Admins receive the native object tree; * user sessions receive only authorized live bindings. Object selections always use named choices. */ class NextFloor extends IPSModuleStrict @@ -88,7 +88,7 @@ class NextFloor extends IPSModuleStrict return 'WebHook registriert: /hook/' . $this->hookPath() . '. Jetzt den Designer öffnen.'; } - /** URL returned to the console form. It opens in a console tab, as IPSView does. */ + /** Browser link returned to the console form; link: does not create a native Pro Console tab. */ public function OpenDesigner(): string { $this->requireWebHook(); diff --git a/symcon/README.md b/symcon/README.md index a33d7ce..57794c9 100644 --- a/symcon/README.md +++ b/symcon/README.md @@ -1,10 +1,12 @@ # NextFloor für IP-Symcon 9.0 -Dieses Verzeichnis ist eine vollständige IP-Symcon-Bibliothek. Der gleiche NextFloor-Designer -läuft damit in zwei Symcon-Oberflächen: +Dieses Verzeichnis ist eine vollständige IP-Symcon-Bibliothek. NextFloor lässt sich +über den Designer und die Kachel-Visualisierung verwenden: - **Designer:** Die Instanzkonfiguration öffnet den Designer per geschütztem WebHook in einem - eigenen Konsolen-/Browser-Tab – derselbe Ansatz, den auch IPSView für seinen Designer nutzt. + Browser-Tab. Auch die installierte Pro-Konsole öffnet diesen Link im Standardbrowser. + IPSViews interner Designer-Tab ist speziell in Symcons Konsole integriert; die öffentliche + Modulschnittstelle von Symcon 9.0 bietet diesen Tab nicht für eigene Web-Oberflächen an. - **Kachel-Visualisierung:** Die NextFloor-Instanz kann direkt in der Tile-Visualisierung als HTML-SDK-Kachel abgelegt werden. Sie zeigt die 3D-Ansicht samt Bedienung. @@ -16,7 +18,7 @@ In **Kerninstanzen → Modules** wird dieses Repository verwendet: Im Zahnrad des Eintrags den Branch **`symcon`** wählen und auf Aktualisierungen prüfen. `main` enthält die Quellen für die Entwicklung, `symcon` die installierbare Bibliothek. -Nach der Aktualisierung auf **0.3.1 / Build 35** die Konsole neu laden. Unter +Nach der Aktualisierung auf **0.3.2 / Build 36** die Konsole neu laden. Unter **Instanz hinzufügen → Hersteller NextFloor** erscheint **„NextFloor Designer und 3D-Kachel“**. ### Für die Entwicklung @@ -65,8 +67,16 @@ Dieselbe Prüfung lässt sich separat mit `node symcon/tests/validate-package.mj Sie ist dauerhaft und enthält kein Zugangs-Token. Die Adresse steht außerdem im Formular: `/hook/nextfloor//` an der Symcon-Serveradresse. +Das Passwortfeld steht direkt unter dem Benutzernamen. Beim Benutzerwechsel werden +Rolle, Schalter und alle drei Freigabetabellen mit den gespeicherten Werten dieses +Benutzers neu befüllt; das Passwortfeld wird geleert. Die Auswahl **Neuen Benutzer +anlegen** leert die Tabellen. Änderungen werden erst mit **Benutzer speichern** +übernommen; ein Wechsel verwirft noch nicht gespeicherte Eingaben. Seit 0.3.2 werden +die nativen Formularlisten zeilenweise übertragen, auch wenn sie leer sind oder +gerade keine Zeile ausgewählt ist. + Die Konten gehören zur jeweiligen NextFloor-Instanz. Die Benutzerverwaltung -bleibt ausschließlich in der Symcon-Konfiguration. **Designer in der Konsole +bleibt ausschließlich in der Symcon-Konfiguration. **Designer im Browser öffnen** ermöglicht dem Symcon-Administrator weiterhin den vollständigen Zugang, auch wenn kein NextFloor-Admin mehr angemeldet ist oder alle Konten gesperrt sind. Der dabei erzeugte Konsolen-Link gilt 90 Sekunden und kann einmal verwendet werden. @@ -571,7 +581,7 @@ Nach dem Update den Designer neu laden, damit die neue Übertragung auf beiden S ### Update bei „Hook not found“ Das vollständige Modul auf 0.2.1 aktualisieren und die NextFloor-Instanzkonfiguration -neu öffnen. Einmal **„WebHook reparieren“**, anschließend **„Designer in der Konsole öffnen“** +neu öffnen. Einmal **„WebHook reparieren“**, anschließend **„Designer im Browser öffnen“** anklicken. Der Eintrag gehört unter **WebHook Control → Hooks (Intern)**; ein eigener PHP-Skript-Hook unter „Benutzerdefiniert“ ist nicht erforderlich. Die bestehende Instanz nicht neu anlegen, da ihr Plan in ihren Attributen gespeichert ist. @@ -600,7 +610,7 @@ nicht neu anlegen, da ihr Plan in ihren Attributen gespeichert ist. ## Einrichtung 1. Eine **NextFloor**-Instanz anlegen. -2. In ihrer Konfiguration auf **„Designer in der Konsole öffnen“** klicken und den Grundriss +2. In ihrer Konfiguration auf **„Designer im Browser öffnen“** klicken und den Grundriss anlegen. 3. Für die Anzeige in der Tile-Visualisierung die Instanz wie jede andere Visualisierungs- Instanz als Kachel hinzufügen. diff --git a/symcon/library.json b/symcon/library.json index ab3a136..a62c7cb 100644 --- a/symcon/library.json +++ b/symcon/library.json @@ -6,7 +6,7 @@ "compatibility": { "version": "9.0" }, - "version": "0.3.1", - "build": 35, - "date": 1794787200 + "version": "0.3.2", + "build": 36, + "date": 1794873600 } diff --git a/symcon/tests/users-form.php b/symcon/tests/users-form.php new file mode 100644 index 0000000..1a1d940 --- /dev/null +++ b/symcon/tests/users-form.php @@ -0,0 +1,82 @@ + (new ReflectionMethod($module, $name))->invoke($module, ...$args); + +// Like a native List variable, this object is iterable/array-accessible but does not JSON-encode its rows. +final class NativeFormList implements IteratorAggregate, ArrayAccess +{ + public function __construct(private array $rows) {} + public function getIterator(): Traversable { foreach ($this->rows as $row) yield new ArrayObject($row); } + public function offsetExists(mixed $offset): bool { return isset($this->rows[$offset]); } + public function offsetGet(mixed $offset): mixed { return $this->rows[$offset] ?? null; } + public function offsetSet(mixed $offset, mixed $value): void { throw new LogicException('Readonly fixture'); } + public function offsetUnset(mixed $offset): void { throw new LogicException('Readonly fixture'); } +} +function NFSC_SaveAccessUser(int $id, string $user, string $name, string $role, bool $enabled, bool $view, bool $control, string $rooms, string $devices, string $objects, string $password): string +{ + global $module; + return $module->SaveAccessUser($user, $name, $role, $enabled, $view, $control, $rooms, $devices, $objects, $password); +} +function NFSC_SelectAccessUser(int $id, string $user): void { global $module; $module->SelectAccessUser($user); } +function formItems(): array +{ + global $module; + $form = json_decode($module->GetConfigurationForm(), true, 512, JSON_THROW_ON_ERROR); + return array_values(array_filter($form['actions'], static fn(array $a): bool => ($a['type'] ?? '') === 'ExpansionPanel'))[0]['items']; +} +function clickSave(string $script, array $fields): string +{ + extract($fields); + $id = 12345; + ob_start(); + try { eval($script); return (string) ob_get_contents(); } + finally { ob_end_clean(); } +} +$items = formItems(); +$names = array_column($items, 'name'); +check(array_search('AccountPassword', $names, true) === array_search('AccountName', $names, true) + 1, 'Password belongs directly below the user name'); +$save = array_values(array_filter($items, static fn(array $item): bool => ($item['caption'] ?? '') === 'Benutzer speichern'))[0]['onClick']; +$script = is_array($save) ? implode("\n", $save) : $save; +$fields = ['AccountSelect' => '', 'AccountName' => 'form-empty', 'AccountRole' => 'user', 'AccountEnabled' => true, + 'AccountViewAll' => true, 'AccountControlAll' => false, 'AccountPassword' => 'form-test-password', + 'AccountRooms' => new NativeFormList([]), 'AccountDevices' => new NativeFormList([]), 'AccountObjects' => new NativeFormList([])]; +check(json_encode($fields['AccountRooms']) === '{}', 'Fixture reproduces the unsupported direct List serialization'); +check(str_starts_with(clickSave($script, $fields), 'Benutzer gespeichert.'), 'The actual save button accepts empty native form lists'); +$emptyID = $module->fields['AccountSelect']['value']; +$empty = $method('accounts')[$emptyID]; +check($empty['rooms'] === [] && $empty['devices'] === [] && $empty['objects'] === [], 'Empty tables remain empty'); + +$rooms = [['target' => 'room:eg:office2', 'access' => 'view'], ['target' => 'room:old:removed', 'access' => 'control']]; +$devices = [['target' => 'furniture:eg:wallbox', 'access' => 'control']]; +$objects = [['target' => 900, 'access' => 'view'], ['target' => 104, 'access' => 'view']]; +$fields = [...$fields, 'AccountName' => 'form-scoped', 'AccountViewAll' => false, + 'AccountRooms' => new NativeFormList($rooms), 'AccountDevices' => new NativeFormList($devices), 'AccountObjects' => new NativeFormList($objects)]; +check(str_starts_with(clickSave($script, $fields), 'Benutzer gespeichert.'), 'The actual save button serializes every row, including rows that are not selected'); +$scopedID = $module->fields['AccountSelect']['value']; +$scoped = $method('accounts')[$scopedID]; +check($scoped['rooms'] === $rooms && $scoped['devices'] === $devices && $scoped['objects'] === $objects, 'All three grant tables retain exact per-user rights'); + +$change = array_values(array_filter($items, static fn(array $item): bool => ($item['name'] ?? '') === 'AccountSelect'))[0]['onChange']; +$select = static function (string $selected) use ($change): void { $id = 12345; $AccountSelect = $selected; eval($change); }; +$select($emptyID); +foreach (['AccountRooms', 'AccountDevices', 'AccountObjects'] as $name) check(json_decode($module->fields[$name]['values'], true) === [], 'Switching to an unrestricted reader clears the previous grants'); +check($module->fields['AccountName']['value'] === 'form-empty' && $module->fields['AccountPassword']['value'] === '', 'User changes load the right name and clear the password field'); +check(!in_array('room:old:removed', array_column(json_decode($module->fields['AccountRooms']['columns'], true)[0]['edit']['options'], 'value'), true), 'Stale target choices do not leak into another user'); +$select($scopedID); +foreach (['AccountRooms' => $rooms, 'AccountDevices' => $devices, 'AccountObjects' => $objects] as $name => $expected) check(json_decode($module->fields[$name]['values'], true) === $expected, 'Each table restores the selected user'); +check(in_array('room:old:removed', array_column(json_decode($module->fields['AccountRooms']['columns'], true)[0]['edit']['options'], 'value'), true), 'Previously linked missing plan targets remain visible when switching users'); +$fields = [...$fields, 'AccountSelect' => $scopedID, 'AccountPassword' => '']; +check(str_starts_with(clickSave($script, $fields), 'Benutzer gespeichert.'), 'Saving an existing user permits an empty password'); +check(password_verify('form-test-password', $method('accounts')[$scopedID]['password']), 'Empty password preserves the previous hash'); +check(str_starts_with(clickSave($script, [...$fields, 'AccountSelect' => '', 'AccountName' => 'no-password']), 'Für neue Benutzer'), 'New accounts still require a password'); +$select(''); +foreach (['AccountRooms', 'AccountDevices', 'AccountObjects'] as $name) check(json_decode($module->fields[$name]['values'], true) === [], 'New user selection resets every grant table'); +check(!$module->fields['AccountReset']['enabled'] && !$module->fields['AccountDelete']['enabled'], 'New user selection disables existing-account operations'); +check($module->SaveAccessUser($emptyID, 'form-empty', 'user', true, true, false, '{"target":"room:eg:office2","access":"control"}', '[]', '[]', '') === 'Ungültige Freigabeliste.', 'A selected row cannot be mistaken for the complete grants list'); + +$form = json_decode($module->GetConfigurationForm(), true); +check($form['actions'][1]['caption'] === 'Designer im Browser öffnen' && $form['actions'][1]['link'] === true, 'The browser link does not promise a native Pro Console tab'); +echo "OK: real form save with opaque iterable Lists; empty/multiple grants; user-switch reload/reset and missing-target choices; password position and preservation; honest browser action\n";