API: Memoize the current_user so that the sudo can work properly
This fixes the SUDO feature of the API, which was broken in !7615 (diffs, comment 19793649).
Note: We will need to backport this fix to 8.13 and 8.12 as well.
Are there points in the code the reviewer needs to double check?
Am I overlooking something regarding how the SUDO feature is supposed to work?
Closes #25482 (closed)