summary refs log tree commit diff
path: root/synapse/rest/admin/users.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Convert user_get_threepids response to attrs. (#16468)Patrick Cloke2023-10-111-2/+1
| | | This improves type annotations by not having a dictionary of Any values.
* Inline simple_search_list/simple_search_list_txn. (#16434)Patrick Cloke2023-10-101-1/+12
| | | | This only has a single use and is over abstracted. Inline it so that we can improve type hints.
* Filter locked users in the admin API (#16328)Hanadi2023-09-181-1/+5
| | | | Co-authored-by: Hanadi Tamimi <hanadi.tamimi@sdui.de>
* Make cached account data/tags/admin types immutable (#16325)Patrick Cloke2023-09-181-4/+4
|
* Add last_seen_ts to the admin users API (#16218)Mathieu Velten2023-09-041-0/+1
|
* Bump ruff from 0.0.277 to 0.0.286 (#16198)dependabot[bot]2023-08-291-2/+5
| | | | Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Allow filtering for admins in the list accounts admin API (#16114)Alexander Fechler2023-08-181-0/+3
|
* Implements admin API to lock an user (MSC3939) (#15870)Mathieu Velten2023-08-101-0/+17
|
* Add not_user_type param to the list accounts admin API (#15844)Michael Weimann2023-07-041-0/+9
| | | Signed-off-by: Michael Weimann <michaelw@element.io>
* Disable incompatible Admin API endpointsQuentin Gliech2023-05-301-0/+8
|
* Clean up and clarify "Create or modify Account" Admin API documentation (#15544)Andrew Morgan2023-05-051-1/+1
|
* Make cleaning up pushers depend on the device_id instead of the token_id ↵Quentin Gliech2023-03-241-1/+0
| | | | | | | | | | | | | | (#15280) This makes it so that we rely on the `device_id` to delete pushers on logout, instead of relying on the `access_token_id`. This ensures we're not removing pushers on token refresh, and prepares for a world without access token IDs (also known as the OIDC). This actually runs the `set_device_id_for_pushers` background update, which was forgotten in #13831. Note that for backwards compatibility it still deletes pushers based on the `access_token` until the background update finishes.
* Move Account Validity callbacks to a dedicated file (#15237)Andrew Morgan2023-03-161-9/+8
|
* Add module API callbacks for adding and deleting local 3PID associations (#15044Andrew Morgan2023-02-271-2/+9
|
* Bump black from 22.12.0 to 23.1.0 (#15103)dependabot[bot]2023-02-221-2/+6
|
* Avoid fetching unused account data in sync. (#14973)Patrick Cloke2023-02-101-1/+2
| | | | | | | The per-room account data is no longer unconditionally fetched, even if all rooms will be filtered out. Global account data will not be fetched if it will all be filtered out.
* Add helper to parse an enum from query args & use it. (#14956)Patrick Cloke2023-02-011-2/+3
| | | | | | | | The `parse_enum` helper pulls an enum value from the query string (by delegating down to the parse_string helper with values generated from the enum). This is used to pull out "f" and "b" in most places and then we thread the resulting Direction enum throughout more code.
* Prefer `type(x) is int` to `isinstance(x, int)` (#14945)David Robertson2023-01-311-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Perfer `type(x) is int` to `isinstance(x, int)` This covered all additional instances I could see where `x` was user-controlled. The remaining cases are ``` $ rg -s 'isinstance.*[^_]int' tests/replication/_base.py 576: if isinstance(obj, int): synapse/util/caches/stream_change_cache.py 136: assert isinstance(stream_pos, int) 214: assert isinstance(stream_pos, int) 246: assert isinstance(stream_pos, int) 267: assert isinstance(stream_pos, int) synapse/replication/tcp/external_cache.py 133: if isinstance(result, int): synapse/metrics/__init__.py 100: if isinstance(calls, (int, float)): synapse/handlers/appservice.py 262: assert isinstance(new_token, int) synapse/config/_util.py 62: if isinstance(p, int): ``` which cover metrics, logic related to `jsonschema`, and replication and data streams. AFAICS these are all internal to Synapse * Changelog
* Remove redundant types from comments. (#14412)Patrick Cloke2022-11-161-2/+3
| | | | | | | Remove type hints from comments which have been added as Python type hints. This helps avoid drift between comments and reality, as well as removing redundant information. Also adds some missing type hints which were simple to fill in.
* Add an Admin API endpoint for looking up users based on 3PID (#14405)Ashish Kumar2022-11-111-0/+25
|
* Allow admins to require a manual approval process before new accounts can be ↵Brendan Abolivier2022-09-291-1/+42
| | | | used (using MSC3866) (#13556)
* Support enabling/disabling pushers (from MSC3881) (#13799)Brendan Abolivier2022-09-211-2/+2
| | | Partial implementation of MSC3881
* Add an admin API endpoint to find a user based on its external ID in an auth ↵Quentin Gliech2022-09-161-0/+27
| | | | provider. (#13810)
* `synapse.api.auth.Auth` cleanup: make permission-related methods use ↵Quentin Gliech2022-08-221-8/+7
| | | | | | | | | `Requester` instead of the `UserID` (#13024) Part of #13019 This changes all the permission-related methods to rely on the Requester instead of the UserID. This is a first step towards enabling scoped access tokens at some point, since I expect the Requester to have scope-related informations in it. It also changes methods which figure out the user/device/appservice out of the access token to return a Requester instead of something else. This avoids having store-related objects in the methods signatures.
* Fix "add user" admin api error when request contains a "msisdn" threepid ↵Thomas Weston2022-07-131-0/+1
| | | | | | (#13263) Co-authored-by: Thomas Weston <thomas.weston@clearspancloud.com> Co-authored-by: David Robertson <david.m.robertson1@gmail.com>
* Allow updating passwords using the admin api without logging out devices ↵Jan Christian Grünhage2022-06-061-1/+7
| | | | (#12952)
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-231-12/+12
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Remove the 'password_hash' from the Users Admin API endpoint response ↵Andrew Morgan2022-01-141-7/+6
| | | | dictionary (#11576)
* Add admin API to get users' account data (#11664)Dirk Klimpel2022-01-051-0/+30
| | | Co-authored-by: reivilibre <olivier@librepush.net>
* Clean up `synapse.rest.admin` (#11535)Dirk Klimpel2021-12-081-27/+24
|
* Convert status codes to `HTTPStatus` in `synapse.rest.admin` (#11452)Dirk Klimpel2021-11-291-62/+111
|
* Rename `get_access_token_for_user_id` method to ↵reivilibre2021-11-171-1/+1
| | | | `create_access_token_for_user_id` (#11369)
* Add ability to un-shadow-ban via the admin API. (#11347)Patrick Cloke2021-11-161-2/+22
|
* Enable changing user type via users admin API (#11174)Jason Robinson2021-10-261-0/+3
| | | | | | | | Users admin API can now also modify user type in addition to allowing it to be set on user creation. Signed-off-by: Jason Robinson <jasonr@matrix.org> Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Fix setting a user's external_id via the admin API returns 500 and deletes ↵Dirk Klimpel2021-10-211-29/+18
| | | | | users existing external mappings if that external ID is already mapped (#11051) Fixes #10846
* Use direct references for configuration variables (part 7). (#10959)Patrick Cloke2021-10-041-2/+2
|
* Use direct references for some configuration variables (part 3) (#10885)Patrick Cloke2021-09-231-2/+2
| | | | | | | | This avoids the overhead of searching through the various configuration classes by directly referencing the class that the attributes are in. It also improves type hints since mypy can now resolve the types of the configuration variables.
* Add missing type hints to non-client REST servlets. (#10817)Patrick Cloke2021-09-151-1/+1
| | | | Including admin, consent, key, synapse, and media. All REST servlets (the synapse.rest module) now require typed method definitions.
* Remove not needed database updates in modify user admin API (#10627)Dirk Klimpel2021-08-191-20/+35
|
* Mount /_synapse/admin/v1/users/{userId}/media admin API on media workers ↵Andrew Morgan2021-08-181-160/+0
| | | | | only (#10628) Co-authored-by: Patrick Cloke <patrickc@matrix.org>
* Flatten the synapse.rest.client package (#10600)reivilibre2021-08-171-2/+2
|
* Allow to edit `external_ids` by Edit User admin API (#10598)Dirk Klimpel2021-08-171-48/+91
| | | Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Admin API to delete media for a specific user (#10558)Dirk Klimpel2021-08-111-6/+74
|
* Add `creation_ts` to list users admin API (#10448)Dirk Klimpel2021-07-221-0/+2
| | | Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Add a return type to parse_string. (#10438)Patrick Cloke2021-07-211-2/+2
| | | | And set the required attribute in a few places which will error if a parameter is not provided.
* Use inline type hints in `handlers/` and `rest/`. (#10382)Jonathan de Jong2021-07-161-1/+1
|
* Add a module type for account validity (#9884)Brendan Abolivier2021-07-161-8/+16
| | | | | This adds an API for third-party plugin modules to implement account validity, so they can provide this feature instead of Synapse. The module implementing the current behaviour for this feature can be found at https://github.com/matrix-org/synapse-email-account-validity. To allow for a smooth transition between the current feature and the new module, hooks have been added to the existing account validity endpoints to allow their behaviours to be overridden by a module.
* Add missing type hints to the admin API servlets (#10105)Dirk Klimpel2021-06-071-10/+5
|
* Remove various bits of compatibility code for Python <3.6 (#9879)Andrew Morgan2021-04-271-1/+2
| | | I went through and removed a bunch of cruft that was lying around for compatibility with old Python versions. This PR also will now prevent Synapse from starting unless you're running Python 3.6+.
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Add an admin API to manage ratelimit for a specific user (#9648)Dirk Klimpel2021-04-131-0/+111
|
* Remove old admin API `GET /_synapse/admin/v1/users/<user_id>` (#9401)Dirk Klimpel2021-04-091-23/+0
| | | | | | | | | | | | | Related: #8334 Deprecated in: #9429 - Synapse 1.28.0 (2021-02-25) `GET /_synapse/admin/v1/users/<user_id>` has no - unit tests - documentation API in v2 is available (#5925 - 12/2019, v1.7.0). API is misleading. It expects `user_id` and returns a list of all users. Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Add `order_by` to list user admin API (#9691)Dirk Klimpel2021-04-011-1/+20
|
* Make it possible to use dmypy (#9692)Erik Johnston2021-03-261-0/+3
| | | | | | | | | Running `dmypy run` will do a `mypy` check while spinning up a daemon that makes rerunning `dmypy run` a lot faster. `dmypy` doesn't support `follow_imports = silent` and has `local_partial_types` enabled, so this PR enables those options and fixes the issues that were newly raised. Note that `local_partial_types` will be enabled by default in upcoming mypy releases.
* Consistently check whether a password may be set for a user. (#9636)Dirk Klimpel2021-03-181-1/+1
|
* Re-Activating account when local passwords are disabled (#9587)Dirk Klimpel2021-03-111-1/+4
| | | Fixes: #8393
* Add type hints to user admin API. (#9521)Dirk Klimpel2021-03-031-29/+56
|
* Add an `order_by` field to list users' media admin API. (#8978)Dirk Klimpel2021-02-221-1/+27
|
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-1/+1
| | | | | | | - Update black version to the latest - Run black auto formatting over the codebase - Run autoformatting according to [`docs/code_style.md `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version
* Fix some typos.Patrick Cloke2021-02-121-1/+1
|
* Add an admin API for shadow-banning users. (#9209)Patrick Cloke2021-01-251-0/+36
| | | | | | | | | | This expands the current shadow-banning feature to be usable via the admin API and adds documentation for it. A shadow-banned users receives successful responses to their client-server API requests, but the events are not propagated into rooms. Shadow-banning a user should be used as a tool of last resort and may lead to confusing or broken behaviour for the client.
* Add tests for List Users Admin API (#9045)Dirk Klimpel2021-01-211-3/+18
|
* Remove user's avatar URL and displayname when deactivated. (#8932)Dirk Klimpel2021-01-121-7/+15
| | | This only applies if the user's data is to be erased.
* Also support remote users on the joined_rooms admin API. (#8948)David Teller2021-01-111-7/+0
| | | | For remote users, only the rooms which the server knows about are returned. Local users have all of their joined rooms returned.
* Convert internal pusher dicts to attrs classes. (#8940)Patrick Cloke2020-12-161-15/+1
| | | This improves type hinting and should use less memory.
* Call set_avatar_url with target_user, not user_id (#8872)Will Hunt2020-12-071-2/+2
| | | | | | | | | | | | | | | | | | | | * Call set_avatar_url with target_user, not user_id Fixes https://github.com/matrix-org/synapse/issues/8871 * Create 8872.bugfix * Update synapse/rest/admin/users.py Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> * Testing * Update changelog.d/8872.bugfix Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Add additional validation for the admin register endpoint. (#8837)David Florness2020-12-021-0/+3
| | | Raise a proper 400 error if the `mac` field is missing.
* Remove deprecated `/_matrix/client/*/admin` endpoints (#8785)Dirk Klimpel2020-11-251-10/+15
| | | These are now only available via `/_synapse/admin/v1`.
* Add admin API for logging in as a user (#8617)Erik Johnston2020-11-171-1/+53
|
* Add `displayname` to Shared-Secret Registration for admins (#8722)Dirk Klimpel2020-11-051-0/+2
| | | Add `displayname` to Shared-Secret Registration for admins to `POST /_synapse/admin/v1/register`
* Add an admin APIs to allow server admins to list users' pushers (#8610)Dirk Klimpel2020-10-281-0/+52
| | | Add an admin API `GET /_synapse/admin/v1/users/<user_id>/pushers` like https://matrix.org/docs/spec/client_server/latest#get-matrix-client-r0-pushers
* Add admin API to list users' local media (#8647)Dirk Klimpel2020-10-271-1/+66
| | | Add admin API `GET /_synapse/admin/v1/users/<user_id>/media` to get information of users' uploaded files.
* Fix a bug in the joined_rooms admin API (#8643)Dirk Klimpel2020-10-261-3/+4
| | | | If the user was not in any rooms then the API returned the same error as if the user did not exist.
* Remove the deprecated Handlers object (#8494)Patrick Cloke2020-10-091-7/+6
| | | All handlers now available via get_*_handler() methods on the HomeServer.
* Admin API for querying rooms where a user is a member (#8306)Dirk Klimpel2020-09-181-0/+26
| | | | Add a new admin API `GET /_synapse/admin/v1/users/<user_id>/joined_rooms` to list all rooms where a user is a member.
* Use admin_patterns for all admin APIs. (#8331)Patrick Cloke2020-09-171-4/+4
| | | This reduces duplication of the admin prefix in regular expressions.
* Search in columns 'name' and 'displayname' in the admin users endpoint (#7377)Manuel Stahl2020-08-251-1/+3
| | | | | * Search in columns 'name' and 'displayname' in the admin users endpoint Signed-off-by: Manuel Stahl <manuel.stahl@awesome-technologies.de>
* Allow accounts to be re-activated from the admin APIs. (#7847)Patrick Cloke2020-07-151-1/+9
|
* Replace all remaining six usage with native Python 3 equivalents (#7704)Dagfinn Ilmari Mannsåker2020-06-161-14/+6
|
* Allow new users to be registered via the admin API even if the monthly ↵Dirk Klimpel2020-06-051-0/+2
| | | | active user limit has been reached (#7263)
* Email notifications for new users when creating via the Admin API. (#7267)Dirk Klimpel2020-06-011-0/+16
|
* Hash passwords earlier in the password reset process (#7538)Patrick Cloke2020-05-201-2/+11
| | | | This now matches the logic of the registration process as modified in 56db0b1365965c02ff539193e26c333b7f70d101 / #7523.
* Hash passwords earlier in the registration process (#7523)Patrick Cloke2020-05-181-15/+15
|
* Return total number of users and profile attributes in admin users endpoint ↵Manuel Stahl2020-04-281-4/+4
| | | | | (#6881) Signed-off-by: Manuel Stahl <manuel.stahl@awesome-technologies.de>
* Add an option to the set password API to choose whether to logout other ↵Patrick Cloke2020-03-181-2/+4
| | | | devices. (#7085)
* Fixed set a user as an admin with the new API (#6928)Dirk Klimpel2020-02-281-4/+2
| | | Fix #6910
* Ensure 'deactivated' parameter is a boolean on user admin API, Fix error ↵Andrew Morgan2020-02-261-4/+7
| | | | handling of call to deactivate user (#6990)
* Return a 404 for admin api user lookup if user not found (#6901)Andrew Morgan2020-02-121-1/+4
|
* Admin api to add an email address (#6789)Dirk Klimpel2020-02-071-0/+39
|
* Allow URL-encoded user IDs on user admin api paths (#6825)Andrew Morgan2020-02-031-2/+2
|
* Minor fixes to user admin api (#6761)Richard van der Hoff2020-01-231-9/+5
| | | | * don't insist on a password (this is valid if you have an SSO login) * fix reference to undefined `requester`
* Remove unnecessary abstractions in admin handler (#6751)Andrew Morgan2020-01-221-10/+9
|
* Fixup synapse.rest to pass mypy (#6732)Erik Johnston2020-01-201-11/+12
|
* Fix changing password via user admin API. (#6730)Erik Johnston2020-01-201-2/+2
|
* Allow admin users to create or modify users without a shared secret (#6495)Manuel Stahl2020-01-091-0/+142
| | | Signed-off-by: Manuel Stahl <manuel.stahl@awesome-technologies.de>
* Replace /admin/v1/users_paginate endpoint with /admin/v2/users (#5925)Manuel Stahl2019-12-051-54/+29
|
* Move admin endpoints into separate files (#6308)Manuel Stahl2019-11-201-2/+404
|
* Port synaps/rest/client/users.py to async/awaitErik Johnston2019-10-111-11/+7
|
* Remove unnecessary parentheses around return statements (#5931)Andrew Morgan2019-08-301-2/+2
| | | | | Python will return a tuple whether there are parentheses around the returned values or not. I'm just sick of my editor complaining about this all over the place :)
* Add GET method to admin API /users/@user:dom/adminOlivier Wilkinson (reivilibre)2019-08-271-8/+32
| | | | Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net>
* Add Admin API capability to set adminship of a user (#5878)reivilibre2019-08-271-0/+76
Admin API: Set adminship of a user