Skip to content

feat(control): new installs let only administrators operate the panel - #329

Merged
cayossarian merged 1 commit into
prerelease/2.2from
feat/new-installs-admin-only-control
Oct 14, 2026
Merged

cayossarian merged 1 commit into
prerelease/2.2from
feat/new-installs-admin-only-control

Conversation

@cayossarian

Copy link
Copy Markdown
Member

New installs default Who may operate the panel to Administrators only. Existing installs keep what they had.

Change

  • control_gate.py: DEFAULT_CONTROL_MODE = ControlMode.ADMIN_ONLY is the mode for an entry that never stored one, in ControlPolicy.default() and from_options. An unrecognised stored value still reads as any user, so a typo in .storage cannot lock a household out.
  • config_flow.py: a new entry stores control_mode: admin_only, beside allow_contextless_control, so a release from before this default reads it the same way after a downgrade. MINOR_VERSION moves to 4.
  • migrations.py: step 7.3 → 7.4 writes all_users into every entry whose stored mode is absent or not a known mode, which is how each one reads today. A known mode is the user's choice and is kept. This is the pattern 7.2 used for control without a logged-in user.
  • config_flow_options.py: the options form shows the new default for an entry with none stored.
  • README: the options table gives the new default and says existing installs keep theirs. CHANGELOG: one Changed entry under 2.2.0.

Checks

  • New tests, each failing before the change: a new entry stores and resolves administrators only; 7.4 keeps any user for an entry that never chose; 7.4 keeps each chosen mode; 7.4 writes any user for an unreadable value ("nonsense", None, 1, a list); Home Assistant actually runs 7.4; the default policy is administrators only. Two 7.3 tests now expect the current minor version.
  • Full suite: 2464 passed, 1 skipped. All commit hooks pass.

An install that has made no choice should not hand every non-admin user
the panel's relays, so the control mode for an entry that never set one
is now administrators only. New entries store it, so a release from
before this default reads the entry the same way after a downgrade.

Entries created before this default allowed any user. Migration 7.4
writes that into each one whose stored mode is absent or unreadable,
the way 7.2 did for control without a logged-in user, so upgrading
takes no control away from anyone. A mode already chosen is kept, and
an unrecognised value still reads as any user.

The README's options table gives the new default.
@cayossarian
cayossarian merged commit b62f424 into prerelease/2.2 Oct 14, 2026
7 checks passed
@cayossarian
cayossarian deleted the feat/new-installs-admin-only-control branch October 14, 2026 21:10
@cayossarian cayossarian mentioned this pull request Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant