Commit Graph
2 Commits
Author SHA1 Message Date
Nic Boet 4571649d8e fix(web): disable the API tab's per-user checkboxes without System edit
The Update and Revoke All Tokens buttons are disabled for users without
System edit since the handlers refuse them; the Revoke Token and API
Enabled checkboxes next to each user stayed clickable and did nothing.
Disable them the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit f096e919c2)
2026-10-31 20:02:16 -04:00
Nic Boet 56996ad3f1 fix: require System edit to change API access or revoke tokens
The API tab of Options renders for any user with System view, and the
view itself handled its two POST buttons: updateSelected sets
Users.APIEnabled for every user and revokeAllTokens bumps every user's
TokenMinExpiry. includes/actions/options.php refuses a System=View user,
but returns before the view is rendered, so the view went on and ran
the UPDATEs. A System=View user could turn off API access for every
account, admins included, and invalidate every issued token.

Run both handlers only when canEdit('System'), log a warning otherwise,
and disable the two buttons for users who cannot use them.
tests/php/test_options_api_requires_system_edit.php includes the view
with System=View and System=Edit and checks which SQL it sends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 6e64739e84)
2026-10-31 20:02:16 -04:00