Commit Graph
7 Commits
Author SHA1 Message Date
Nic BoetandClaude Opus 5.5 110d599f75 fix: honour ZM_USER_SELF_EDIT in the users API
UsersController::view() and edit() assigned their permission check with
`$canX = A or B;`. `=` binds tighter than `or`, so only A was stored and the
self check was dropped: with ZM_USER_SELF_EDIT on, a user without System=Edit
got 401 on PUT users/<own id>.json. beforeFilter() also refused every user
with System=None before view() or edit() ran.

Let beforeFilter() through view and edit of the user's own record while
ZM_USER_SELF_EDIT is on, use || in both checks, and limit what such a user
saves to the fields the web UI allows for self edit
(includes/actions/user.php): Password, Language and HomeView. The request
data is rebuilt from those three fields, so Id, System, permissions and the
rest are never saved; a Language without a lang file is refused as in the UI.
Users with System=Edit save as before.

Self view follows the web UI too: a user without System permission sees their
own record only while ZM_USER_SELF_EDIT is on.

fixes #5242

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 11:28:40 -05:00
stefan 1bd9def63e [API] Fix User variable from array to object
Fix $user variable from array to object to make API work again.
2023-04-23 22:07:24 +02:00
Isaac Connor 02a1ecee6f Remove dbeug 2021-04-26 09:40:08 -04:00
Isaac Connor d07d85dd6c Clean User add to match behaviour of Monitors. For some reason posting to index doesn't call add unlike Monitors. Clean out duplicated Views 2021-04-22 12:25:13 -04:00
Isaac Connor bf163beedb Update permissions checking when viewing/editing users. Fixes #2982. Also add a beforeFind that will remove the Password field from the query so that we don't return passwords 2020-07-30 11:03:24 -04:00
Isaac Connor 135bbb4190 remove unneeded config loading, just use defines. Spacing, remove commented out dead code 2020-07-19 17:51:28 -04:00
Isaac Connor e0d2a14f3c add in User Model/Controller and rough in auth. 2015-06-30 11:27:17 -04:00