zulip/zerver/views
m-e-l-u-h-a-n 0e6343c071 users: Clarify readability issues related to access_user_by_id.
zerver/lib/users.py has a function named access_user_by_id, which is
used in /users views to fetch a user by it's id. Along with fetching
the user this function also does important validations regarding
checking of required permissions for fetching the target user.

In an attempt to solve the above problem this commit introduces
following changes:
1. Make all the parameters except user_profile, target_user_id
   to be keyword only.
2. Use for_admin parameter instead of read_only.
3. Adds a documentary note to the function describing the reason for
   changes along with recommended way to call this function in future.
4. Changes in views and tests to call this function in this changed
   format.

Changes were tested using ./tools/test-backend.

Fixes #17111.
2021-02-05 17:31:45 -08:00
..
development docs: Fix more capitalization issues. 2020-10-23 11:46:55 -07:00
__init__.py
alert_words.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
archive.py refactor: Use recipient_id to get topic history. 2020-10-16 12:58:11 -07:00
attachments.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
auth.py auth: Handle the case of invalid subdomain at various points. 2021-01-11 22:29:50 -08:00
camo.py python: Replace binascii with bytes.hex to skip some decode operations. 2020-10-30 11:36:38 -07:00
compatibility.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
custom_profile_fields.py custom_profile_fields: Don't allow leading/trailing whitespaces. 2020-10-02 14:58:06 -07:00
digest.py refactor: Extract get_digest_context. 2020-11-05 09:36:59 -08:00
documentation.py docs: Fix more capitalization issues. 2020-10-23 11:46:55 -07:00
drafts.py message: Bundle message stripping, validation, and truncation. 2020-12-18 17:44:13 -08:00
email_mirror.py email-mirror-postfix: Handle 8-bit messages correctly. 2020-06-14 20:24:06 -07:00
events_register.py events_register_backend: Validate client_capabilities type correctly. 2020-06-20 22:29:15 -07:00
home.py home: Allow logged out user through home. 2020-11-02 17:07:12 -08:00
hotspots.py python: Convert percent formatting to .format for translated strings. 2020-06-15 16:24:46 -07:00
invite.py performance: Remove recipient from access_stream_by_id. 2020-10-16 12:58:11 -07:00
message_edit.py message: Bundle message stripping, validation, and truncation. 2020-12-18 17:44:13 -08:00
message_fetch.py anchor_value: Fix parsing of large anchor values. 2020-12-02 11:00:22 -08:00
message_flags.py performance: Remove recipient from access_stream_by_id. 2020-10-16 12:58:11 -07:00
message_send.py models: Rename is_api_super_user to can_forge_sender, 2020-12-21 13:15:39 -08:00
muting.py refactor: Remove recipient from access_stream_by_name. 2020-10-16 12:58:11 -07:00
portico.py apps: Use GitHub API for generating the web app download link. 2020-10-28 23:04:14 -07:00
presence.py python: Convert percent formatting to .format for translated strings. 2020-06-15 16:24:46 -07:00
push_notifications.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
reactions.py emoji: Switch to `user_profile.realm` for cross-realm reactions. 2020-07-24 13:11:27 -07:00
realm.py performance: Remove recipient from access_stream_by_id. 2020-10-16 12:58:11 -07:00
realm_domains.py audit_log: Log RealmAuditLog in do_set_realm_property. 2020-07-06 17:38:19 -07:00
realm_emoji.py python: Convert percent formatting to .format for translated strings. 2020-06-15 16:24:46 -07:00
realm_export.py python: Replace ujson with orjson. 2020-08-11 10:55:12 -07:00
realm_filters.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
realm_icon.py docs: Fix more capitalization issues. 2020-10-23 11:46:55 -07:00
realm_logo.py docs: Fix more capitalization issues. 2020-10-23 11:46:55 -07:00
registration.py registration: Stop enqueueing to the signups queue. 2021-01-24 09:42:55 -08:00
report.py python: Catch specific exceptions from subprocess. 2020-10-11 16:11:41 -07:00
storage.py update_storage: Validate storage type correctly. 2020-06-20 22:29:15 -07:00
streams.py streams: Do not allow default streams to be private. 2020-10-29 15:47:32 -07:00
submessage.py python: Catch specific exceptions from orjson. 2020-10-11 16:11:41 -07:00
thumbnail.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
tutorial.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
typing.py python: Sort imports with isort. 2020-06-11 16:45:32 -07:00
unsubscribe.py python: Prefer kwargs form of dict.update. 2020-09-03 17:51:09 -07:00
upload.py python: Convert percent formatting to .format for translated strings. 2020-06-15 16:24:46 -07:00
user_groups.py user_groups: Use 'path_only=True' in REQ for 'user_group_id' in views. 2020-08-26 15:40:19 -07:00
user_settings.py exceptions: Make RateLimited into a subclass of JsonableError. 2020-12-01 13:40:56 -08:00
users.py users: Clarify readability issues related to access_user_by_id. 2021-02-05 17:31:45 -08:00
video_calls.py python: Skip unnecessary decode before JSON parsing. 2020-10-30 11:36:38 -07:00
zephyr.py docs: Fix more capitalization issues. 2020-10-23 11:46:55 -07:00