summary refs log tree commit diff
path: root/tests/rest/admin (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Add an Admin API to temporarily grant the ability to update an existing ↵David Robertson2023-11-151-0/+56
| | | | cross-signing key without UIA (#16634)
* Use full GitHub links instead of bare issue numbers. (#16637)Patrick Cloke2023-11-151-1/+1
|
* Convert simple_select_one_txn and simple_select_one to return tuples. (#16612)Patrick Cloke2023-11-091-1/+1
|
* Return attrs for more media repo APIs. (#16611)Patrick Cloke2023-11-091-8/+8
|
* Ensure local invited & knocking users leave before purge. (#16559)Patrick Cloke2023-10-271-1/+52
| | | | | This is mostly useful for federated rooms where some users would get stuck in the invite or knock state when the room was purged from their homeserver.
* Register media servlets via regex. (#16419)Patrick Cloke2023-10-064-107/+58
| | | | | This converts the media servlet URLs in the same way as (most) of the rest of Synapse. This will give more flexibility in the versions each endpoint exists under.
* Remove Python version from `/_synapse/admin/v1/server_version` (#16380)MomentQYC2023-10-021-3/+1
| | | | There's no reason to expose the full Python version over what is frequently a public API.
* Filter locked users in the admin API (#16328)Hanadi2023-09-181-0/+26
| | | | Co-authored-by: Hanadi Tamimi <hanadi.tamimi@sdui.de>
* Add automatic purge after all users forget a room (#15488)Mathieu Velten2023-09-152-18/+161
| | | | | | Also add restore of purge/shutdown rooms after a synapse restart. Co-authored-by: Eric Eastwood <erice@matrix.org> Co-authored-by: Erik Johnston <erikj@matrix.org>
* Update ruff config (#16283)Patrick Cloke2023-09-081-3/+3
| | | Enable additional checks & clean-up unneeded configuration.
* Add last_seen_ts to the admin users API (#16218)Mathieu Velten2023-09-041-0/+60
|
* Bump mypy-zope & mypy. (#16188)Patrick Cloke2023-08-292-3/+3
|
* Replace make_awaitable with AsyncMock (#16179)Patrick Cloke2023-08-241-8/+8
| | | | Python 3.8 provides a native AsyncMock, we can replace the homegrown version we have.
* Allow filtering for admins in the list accounts admin API (#16114)Alexander Fechler2023-08-181-0/+38
|
* Implements admin API to lock an user (MSC3939) (#15870)Mathieu Velten2023-08-101-1/+110
|
* Actually stop reading from column `user_id` of tables `profiles` (#15955)Shay2023-07-231-1/+1
|
* Mark get_user_in_directory private since only used in tests (#15884)Mathieu Velten2023-07-121-3/+3
|
* Add not_user_type param to the list accounts admin API (#15844)Michael Weimann2023-07-041-0/+78
| | | Signed-off-by: Michael Weimann <michaelw@element.io>
* Tests for JWKS endpointHugh Nimmo-Smith2023-05-301-0/+106
|
* Remove references to supporting per-user flag for msc2654 (#15522)Shay2023-05-021-6/+2
|
* Add an admin API endpoint to support per-user feature flags (#15344)Shay2023-04-281-0/+127
|
* Add column `full_user_id` to tables `profiles` and `user_filters`. (#15458)Shay2023-04-261-6/+24
|
* Make cleaning up pushers depend on the device_id instead of the token_id ↵Quentin Gliech2023-03-241-2/+2
| | | | | | | | | | | | | | (#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.
* Fix error when sending message into deleted room. (#15235)Erik Johnston2023-03-211-0/+15
| | | | | | | | When a room is deleted in Synapse we remove the event forward extremities in the room, so if (say a bot) tries to send a message into the room we error out due to not being able to calculate prev events for the new event *before* we check if the sender is in the room. Fixes #8094
* Admin API endpoint to delete a reported event (#15116)Dirk Klimpel2023-02-281-2/+141
| | | | | | | | | | | | | | | | | | | | | * Admin api to delete event report * lint + tests * newsfile * Apply suggestions from code review Co-authored-by: David Robertson <david.m.robertson1@gmail.com> * revert changes - move to WorkerStore * update unit test * Note that timestamp is in millseconds --------- Co-authored-by: David Robertson <david.m.robertson1@gmail.com>
* Refactor media modules. (#15146)Patrick Cloke2023-02-272-2/+2
| | | | | | | * Removes the `v1` directory from `test.rest.media.v1`. * Moves the non-REST code from `synapse.rest.media.v1` to `synapse.media`. * Flatten the `v1` directory from `synapse.rest.media`, but leave compatiblity with 3rd party media repositories and spam checkers.
* Bump black from 22.12.0 to 23.1.0 (#15103)dependabot[bot]2023-02-224-10/+0
|
* Add final type hint to tests.unittest. (#15072)Patrick Cloke2023-02-142-6/+14
| | | | Adds a return type to HomeServerTestCase.make_homeserver and deal with any variables which are no longer Any.
* Return read-only collections from `@cached` methods (#13755)Sean Quah2023-02-101-2/+2
| | | | | | | | | | | | | It's important that collections returned from `@cached` methods are not modified, otherwise future retrievals from the cache will return the modified collection. This applies to the return values from `@cached` methods and the values inside the dictionaries returned by `@cachedList` methods. It's not necessary for the dictionaries returned by `@cachedList` methods themselves to be read-only. Signed-off-by: Sean Quah <seanq@matrix.org> Co-authored-by: David Robertson <davidr@element.io>
* Add a class UnpersistedEventContext to allow for the batching up of storing ↵Shay2023-02-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | state groups (#14675) * add class UnpersistedEventContext * modify create new client event to create unpersistedeventcontexts * persist event contexts after creation * fix tests to persist unpersisted event contexts * cleanup * misc lints + cleanup * changelog + fix comments * lints * fix batch insertion? * reduce redundant calculation * add unpersisted event classes * rework compute_event_context, split into function that returns unpersisted event context and then persists it * use calculate_context_info to create unpersisted event contexts * update typing * $%#^&* * black * fix comments and consolidate classes, use attr.s for class * requested changes * lint * requested changes * requested changes * refactor to be stupidly explicit * clearer renaming and flow * make partial state non-optional * update docstrings --------- Co-authored-by: Erik Johnston <erik@matrix.org>
* Respond correctly to unknown methods on known endpoints (#14605)Patrick Cloke2023-02-091-3/+6
| | | | Respond with a 405 error if a request is received on a known endpoint, but to an unknown method, per MSC3743.
* Add helper to parse an enum from query args & use it. (#14956)Patrick Cloke2023-02-011-1/+4
| | | | | | | | 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.
* Faster joins: omit partial rooms from eager syncs until the resync completes ↵David Robertson2023-01-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#14870) * Allow `AbstractSet` in `StrCollection` Or else frozensets are excluded. This will be useful in an upcoming commit where I plan to change a function that accepts `List[str]` to accept `StrCollection` instead. * `rooms_to_exclude` -> `rooms_to_exclude_globally` I am about to make use of this exclusion mechanism to exclude rooms for a specific user and a specific sync. This rename helps to clarify the distinction between the global config and the rooms to exclude for a specific sync. * Better function names for internal sync methods * Track a list of excluded rooms on SyncResultBuilder I plan to feed a list of partially stated rooms for this sync to ignore * Exclude partial state rooms during eager sync using the mechanism established in the previous commit * Track un-partial-state stream in sync tokens So that we can work out which rooms have become fully-stated during a given sync period. * Fix mutation of `@cached` return value This was fouling up a complement test added alongside this PR. Excluding a room would mean the set of forgotten rooms in the cache would be extended. This means that room could be erroneously considered forgotten in the future. Introduced in #12310, Synapse 1.57.0. I don't think this had any user-visible side effects (until now). * SyncResultBuilder: track rooms to force as newly joined Similar plan as before. We've omitted rooms from certain sync responses; now we establish the mechanism to reintroduce them into future syncs. * Read new field, to present rooms as newly joined * Force un-partial-stated rooms to be newly-joined for eager incremental syncs only, provided they're still fully stated * Notify user stream listeners to wake up long polling syncs * Changelog * Typo fix Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com> * Unnecessary list cast Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com> * Rephrase comment Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com> * Another comment Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com> * Fixup merge(?) * Poke notifier when receiving un-partial-stated msg over replication * Fixup merge whoops Thanks MV :) Co-authored-by: Mathieu Velen <mathieuv@matrix.org> Co-authored-by: Mathieu Velten <mathieuv@matrix.org> Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
* Respond with proper error responses on unknown paths. (#14621)Patrick Cloke2022-12-081-1/+1
| | | | Returns a proper 404 with an errcode of M_RECOGNIZED for unknown endpoints per MSC3743.
* Implement message forward pagination from start when no from is given, fixes ↵Benjamin Kampmann2022-11-241-0/+40
| | | | | #12383 (#14149) Fixes https://github.com/matrix-org/synapse/issues/12383
* Add a type hint for `get_device_handler()` and fix incorrect types. (#14055)Patrick Cloke2022-11-221-1/+4
| | | | | This was the last untyped handler from the HomeServer object. Since it was being treated as Any (and thus unchecked) it was being used incorrectly in a few places.
* Add an Admin API endpoint for looking up users based on 3PID (#14405)Ashish Kumar2022-11-111-13/+94
|
* Show erasure status when listing users in the Admin API (#14205)Tadeusz Sośnierz2022-10-211-1/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Show erasure status when listing users in the Admin API * Use USING when joining erased_users * Add changelog entry * Revert "Use USING when joining erased_users" This reverts commit 30bd2bf106415caadcfdbdd1b234ef2b106cc394. * Make the erased check work on postgres * Add a testcase for showing erased user status * Appease the style linter * Explicitly convert `erased` to bool to make SQLite consistent with Postgres This also adds us an easy way in to fix the other accidentally integered columns. * Move erasure status test to UsersListTestCase * Include user erased status when fetching user info via the admin API * Document the erase status in user_admin_api * Appease the linter and mypy * Signpost comments in tests Co-authored-by: Tadeusz Sośnierz <tadeusz@sosnierz.com> Co-authored-by: David Robertson <david.m.robertson1@gmail.com>
* Allow admins to require a manual approval process before new accounts can be ↵Brendan Abolivier2022-09-291-2/+184
| | | | used (using MSC3866) (#13556)
* Support enabling/disabling pushers (from MSC3881) (#13799)Brendan Abolivier2022-09-211-1/+1
| | | 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/+87
| | | | provider. (#13810)
* Add timestamp to user's consent (#13741)Dirk Klimpel2022-09-081-0/+1
| | | Co-authored-by: reivilibre <olivier@librepush.net>
* Add Admin API to Fetch Messages Within a Particular Window (#13672)Connor Davis2022-09-071-1/+157
| | | This adds two new admin APIs that allow us to fetch messages from a room within a particular time.
* Fix admin List Room API return type on sqlite (#13509)David Robertson2022-08-311-5/+14
|
* Fix that sending server notices fail if avatar is `None` (#13566)Dirk Klimpel2022-08-231-0/+56
| | | Indroduced in #11846.
* Implement MSC3852: Expose `last_seen_user_agent` to users for their own ↵Andrew Morgan2022-08-191-1/+91
| | | | devices; also expose to Admin API (#13549)
* Fix a bug in the `/event_reports` Admin API which meant that the total count ↵reivilibre2022-08-171-0/+27
| | | | | could be larger than the number of results you can actually query for. (#13525) Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Add forgotten status to Room Details API (#13503)Dirk Klimpel2022-08-171-0/+1
|
* Use literals in place of `HTTPStatus` constants in tests (#13488)Dirk Klimpel2022-08-1011-447/+176
| | | | | | | | | * Use literals in place of `HTTPStatus` constants in tests * newsfile * code style * code style
* Use literals in place of `HTTPStatus` constants in tests (#13479)Dirk Klimpel2022-08-0911-141/+140
| | | | | | | | | | Replace - `HTTPStatus.NOT_FOUND` - `HTTPStatus.FORBIDDEN` - `HTTPStatus.UNAUTHORIZED` - `HTTPStatus.CONFLICT` - `HTTPStatus.CREATED` Signed-off-by: Dirk Klimpel <dirk@klimpel.org>
* Use literals in place of `HTTPStatus` constants in tests (#13469)Dirk Klimpel2022-08-0812-331/+328
|
* Return 404 or member list when getting joined_members after leaving (#13374)andrew do2022-08-031-0/+15
| | | | | | Signed-off-by: Andrew Doh <andrewddo@gmail.com> Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> Co-authored-by: Andrew Morgan <andrewm@element.io> Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Make minor clarifications to the error messages given when we fail to join a ↵reivilibre2022-07-271-1/+4
| | | | room via any server. (#13160)
* Use HTTPStatus constants in place of literals in tests. (#13297)Dirk Klimpel2022-07-151-8/+8
|
* Fix "add user" admin api error when request contains a "msisdn" threepid ↵Thomas Weston2022-07-131-0/+35
| | | | | | (#13263) Co-authored-by: Thomas Weston <thomas.weston@clearspancloud.com> Co-authored-by: David Robertson <david.m.robertson1@gmail.com>
* expose whether a room is a space in the Admin API (#13208)andrew do2022-07-121-3/+10
|
* annotate tests.server.FakeChannel (#13136)David Robertson2022-07-042-3/+3
|
* Remove remaining pieces of groups code. (#12966)Patrick Cloke2022-06-061-2/+0
| | | | | * Remove an unused stream ID generator. * Remove the now unused remote profile cache.
* Rename storage classes (#12913)Erik Johnston2022-05-311-2/+2
|
* Remove user-visible groups/communities code (#12553)Patrick Cloke2022-05-251-89/+1
| | | | | | | | | Makes it so that groups/communities no longer exist from a user-POV. E.g. we remove: * All API endpoints (including Client-Server, Server-Server, and admin). * Documented configuration options (and the experimental flag, which is now unused). * Special handling during room upgrades. * The `groups` section of the `/sync` response.
* Delete events from federation_inbound_events_staging table on purge (#12770)Mathieu Velten2022-05-171-0/+1
|
* Disable groups/communities by default. (#12344)Patrick Cloke2022-04-121-0/+1
| | | | This disables the endpoints (and sync response fields) for groups/communities by default.
* Update the server notices user profile in room if changed. (#12115)Jorge Florian2022-04-081-0/+92
|
* Add type hints for `tests/unittest.py`. (#12347)Richard van der Hoff2022-04-012-6/+17
| | | In particular, add type hints for get_success and friends, which are then helpful in a bunch of places.
* Remove redundant `get_success` calls in test code (#12346)Richard van der Hoff2022-04-011-9/+3
| | | There are a bunch of places we call get_success on an immediate value, which is unnecessary. Let's rip them out, and remove the redundant functionality in get_success and friends.
* Always allow the empty string as an avatar_url. (#12261)David Robertson2022-03-251-0/+19
| | | | | Hopefully this fixes #12257. Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Add config settings for background update parameters (#11980)Shay2022-03-111-4/+5
|
* Fix a bug in background updates wherein background updates are never run ↵Shay2022-03-071-10/+8
| | | | using the default batch size (#12157)
* Replace assertEquals and friends with non-deprecated versions. (#12092)Patrick Cloke2022-02-281-7/+7
|
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-237-20/+20
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Add type hints to `tests/rest/admin` (#11851)Dirk Klimpel2022-01-313-229/+183
|
* Add admin API to get a list of federated rooms (#11658)Dirk Klimpel2022-01-251-25/+277
|
* Add admin API to reset connection timeouts for remote server (#11639)Dirk Klimpel2022-01-251-4/+51
| | | * Fix get federation status of destination if no error occured
* Drop unused table `public_room_list_stream`. (#11795)Richard van der Hoff2022-01-211-1/+0
| | | This is a follow-up to #10565.
* Make pagination of rooms in admin api stable (#11737)Daniel Sonck2022-01-171-19/+28
| | | | | | | | | | | | | | Always add state.room_id after the configurable ORDER BY. Otherwise, for any sort, certain pages can contain results from other pages. (Especially when sorting by creator, since there may be many rooms by the same creator) * Document different order direction of numerical fields "joined_members", "joined_local_members", "version" and "state_events" are ordered in descending direction by default (dir=f). Added a note in tests to explain the differences in ordering. Signed-off-by: Daniël Sonck <daniel@sonck.nl>
* Remove the 'password_hash' from the Users Admin API endpoint response ↵Andrew Morgan2022-01-141-17/+33
| | | | dictionary (#11576)
* Replace uses of simple_insert_many with simple_insert_many_values. (#11742)Patrick Cloke2022-01-131-11/+4
| | | | This should be (slightly) more efficient and it is simpler to have a single method for inserting multiple values.
* Fix get federation status of destination if no error occured (#11593)Dirk Klimpel2022-01-051-18/+57
|
* Add admin API to get users' account data (#11664)Dirk Klimpel2022-01-051-0/+90
| | | Co-authored-by: reivilibre <olivier@librepush.net>
* Add type hints to `synapse/tests/rest/admin` (#11590)Dirk Klimpel2021-12-165-57/+70
|
* Ensure emails are canonicalized before fetching associated user. (#11547)Patrick Cloke2021-12-101-1/+2
| | | | This should fix pushers with an email in non-canonical form is used as the pushkey.
* Add missing `errcode` to `parse_string` and `parse_boolean` (#11542)Dirk Klimpel2021-12-094-10/+10
|
* Clean up `synapse.rest.admin` (#11535)Dirk Klimpel2021-12-081-1/+1
|
* Fix 'delete room' admin api to work on incomplete rooms (#11523)Richard van der Hoff2021-12-071-17/+25
| | | | | If, for some reason, we don't have the create event, we should still be able to purge a room.
* Add admin API to get some information about federation status (#11407)Dirk Klimpel2021-12-061-0/+456
|
* Add type hints to `synapse/tests/rest/admin` (#11501)Dirk Klimpel2021-12-039-225/+256
|
* Remove unnecessary `json.dumps` from `tests.rest.admin` (#11461)Dirk Klimpel2021-11-301-41/+20
| | | | | The tests helpers automatically convert dictionaries to JSON payloads, no need to do it manually for each test.
* Convert status codes to `HTTPStatus` in `tests.rest.admin` (#11455)Dirk Klimpel2021-11-3011-557/+886
|
* Make background updates controllable via a plugin (#11306)Erik Johnston2021-11-291-1/+1
| | | Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Lower minumum batch size to 1 for background updates (#11422)Brendan Abolivier2021-11-241-8/+17
| | | Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Add an admin API to run background jobs. (#11352)Dirk Klimpel2021-11-191-8/+146
| | | | | | Instead of having admins poke into the database directly. Can currently run jobs to populate stats and to populate the user directory.
* Add dedicated admin API for blocking a room (#11324)Dirk Klimpel2021-11-181-0/+228
|
* Rename `get_access_token_for_user_id` method to ↵reivilibre2021-11-171-2/+2
| | | | `create_access_token_for_user_id` (#11369)
* Add ability to un-shadow-ban via the admin API. (#11347)Patrick Cloke2021-11-161-6/+20
|
* Convert delete room admin API to async endpoint (#11223)Dirk Klimpel2021-11-122-65/+709
| | | Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Allow admins to proactively block rooms (#11228)David Robertson2021-11-091-0/+28
| | | | Co-authored-by: Dirk Klimpel <5740567+dklimpel@users.noreply.github.com> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Add some background update admin APIs (#11263)Erik Johnston2021-11-081-0/+218
| | | Fixes #11259
* Add search by room ID and room alias to List Room admin API (#11099)Dirk Klimpel2021-11-021-39/+49
| | | | Fixes: #10874 Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Fix a bug in unit test `test_block_room_and_not_purge` (#11226)Dirk Klimpel2021-11-011-2/+2
|
* Remove deprecated delete room admin API (#11213)Dirk Klimpel2021-11-011-24/+15
| | | | | Remove deprecated delete room admin API, `POST /_synapse/admin/v1/rooms/<room_id>/delete`
* Enable changing user type via users admin API (#11174)Jason Robinson2021-10-261-0/+51
| | | | | | | | 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-3/+212
| | | | | users existing external mappings if that external ID is already mapped (#11051) Fixes #10846
* Show error when timestamp in seconds is provided to the /purge_media_cache ↵Aaron R2021-10-201-4/+102
| | | | API (#11101)
* Simplify the user admin API tests (#11048)Dirk Klimpel2021-10-121-255/+146
|
* Use direct references for configuration variables (part 7). (#10959)Patrick Cloke2021-10-041-2/+2
|
* Use direct references for configuration variables (part 6). (#10916)Patrick Cloke2021-09-291-3/+3
|
* Use direct references for configuration variables (part 5). (#10897)Patrick Cloke2021-09-242-3/+3
|
* Add reactor to `SynapseRequest` and fix up types. (#10868)Erik Johnston2021-09-243-7/+7
|
* Allow `.` and `~` chars in registration tokens (#10887)Callum Brown2021-09-231-3/+5
| | | | Per updates to MSC3231 in order to use the same grammar as other identifiers.
* Use direct references for some configuration variables (part 3) (#10885)Patrick Cloke2021-09-231-1/+1
| | | | | | | | 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.
* Allow Synapse Admin API's Room Search to accept non-ASCII characters (#10859)Hillery Shay2021-09-211-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * add tests for checking if room search works with non-ascii char * change encoding on parse_string to UTF-8 * lints * properly encode search term * lints * add changelog file * update changelog number * set changelog entry filetype to .bugfix * Revert "set changelog entry filetype to .bugfix" This reverts commit be8e5a314251438ec4ec7dbc59ba32162c93e550. * update changelog message and file type * change parse_string default encoding back to ascii and update room search admin api calll to parse string * refactor tests * Update tests/rest/admin/test_room.py Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com> Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Create a constant for a small png image in tests. (#10834)Patrick Cloke2021-09-164-66/+22
| | | To avoid duplicating it between a few tests.
* Improve ServerNoticeServlet to avoid duplicate requests (#10679)Dirk Klimpel2021-08-271-0/+450
| | | Fixes: #9544
* Implement MSC3231: Token authenticated registration (#10142)Callum Brown2021-08-211-0/+710
| | | | | Signed-off-by: Callum Brown <callum@calcuode.com> This is part of my GSoC project implementing [MSC3231](https://github.com/matrix-org/matrix-doc/pull/3231).
* Simplify tests for the device admin rest API. (#10664)Dirk Klimpel2021-08-201-81/+18
| | | | By replacing duplicated code with parameterized tests and avoiding unnecessary dumping of JSON data.
* Remove not needed database updates in modify user admin API (#10627)Dirk Klimpel2021-08-191-4/+58
|
* Remove deprecated Shutdown Room and Purge Room Admin API (#8830)Dirk Klimpel2021-08-171-162/+0
|
* Flatten the synapse.rest.client package (#10600)reivilibre2021-08-178-11/+8
|
* Allow to edit `external_ids` by Edit User admin API (#10598)Dirk Klimpel2021-08-171-30/+197
| | | Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Add an admin API to check if a username is available (#10578)Will Hunt2021-08-171-0/+62
| | | This adds a new API GET /_synapse/admin/v1/username_available?username=foo to check if a username is available. It is the counterpart to https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-register-available, except that it works even if registration is disabled.
* Admin API to delete media for a specific user (#10558)Dirk Klimpel2021-08-111-113/+208
|
* Add `creation_ts` to list users admin API (#10448)Dirk Klimpel2021-07-221-18/+27
| | | Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Add type hints to additional servlet functions (#10437)Patrick Cloke2021-07-211-2/+2
| | | | | | | | | Improves type hints for: * parse_{boolean,integer} * parse_{boolean,integer}_from_args * parse_json_{value,object}_from_request And fixes any incorrect calls that resulted from unknown types.
* [pyupgrade] `tests/` (#10347)Jonathan de Jong2021-07-132-14/+12
|
* Remove functionality associated with unused historical stats tables (#9721)Cristina2021-07-081-1/+0
| | | Fixes #9602
* Fix deactivate a user if he does not have a profile (#10252)Dirk Klimpel2021-07-061-18/+68
|
* Add SSO `external_ids` to Query User Account admin API (#10261)Dirk Klimpel2021-07-011-84/+140
| | | Related to #10251
* Add new admin APIs to remove media by media ID from quarantine. (#10044)Dirk Klimpel2021-06-021-0/+128
| | | | | Related to: #6681, #5956, #10040 Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Make reason and score optional for report_event (#10077)Callum Brown2021-05-271-1/+14
| | | | | | Implements MSC2414: https://github.com/matrix-org/matrix-doc/pull/2414 See #8551 Signed-off-by: Callum Brown <callum@calcuode.com>
* Add an admin API for unprotecting local media from quarantine (#10040)Dirk Klimpel2021-05-261-0/+99
| | | Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Delete room endpoint (#9889)ThibF2021-04-291-19/+26
| | | | | | Support the delete of a room through DELETE request and mark previous request as deprecated through documentation. Signed-off-by: Thibault Ferrante <thibault.ferrante@pm.me>
* Remove various bits of compatibility code for Python <3.6 (#9879)Andrew Morgan2021-04-271-9/+6
| | | 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+.
* Fix (final) Bugbear violations (#9838)Jonathan de Jong2021-04-205-13/+13
|
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-148-8/+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/+284
|
* Use mock from the stdlib. (#9772)Patrick Cloke2021-04-093-6/+3
|
* Add `order_by` to list user admin API (#9691)Dirk Klimpel2021-04-011-1/+120
|
* Consistently check whether a password may be set for a user. (#9636)Dirk Klimpel2021-03-181-55/+118
|
* Add an `order_by` field to list users' media admin API. (#8978)Dirk Klimpel2021-02-221-21/+225
|
* Add the shadow-banning status to the display user admin API. (#9400)Dirk Klimpel2021-02-171-0/+2
|
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-167-252/+748
| | | | | | | - 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
* Merge pull request #9150 from Yoric/develop-contextDavid Teller2021-02-081-0/+84
|\ | | | | New API /_synapse/admin/rooms/{roomId}/context/{eventId}
| * FIXUP: linterDavid Teller2021-01-281-1/+3
| |
| * FIXUP: Now testing that the user is admin!David Teller2021-01-281-1/+35
| |
| * New API /_synapse/admin/rooms/{roomId}/context/{eventId}David Teller2021-01-281-0/+48
| | | | | | | | Signed-off-by: David Teller <davidt@element.io>
* | Add an admin API to get the current room state (#9168)Travis Ralston2021-02-021-0/+15
|/ | | | | This could arguably replace the existing admin API for `/members`, however that is out of scope of this change. This sort of endpoint is ideal for moderation use cases as well as other applications, such as needing to retrieve various bits of information about a room to perform a task (like syncing power levels between two places). This endpoint exposes nothing more than an admin would be able to access with a `select *` query on their database.
* Add an admin API for shadow-banning users. (#9209)Patrick Cloke2021-01-251-0/+64
| | | | | | | | | | 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-27/+196
|
* Add an admin API endpoint to protect media. (#9086)Patrick Cloke2021-01-151-3/+5
| | | | | | Protecting media stops it from being quarantined when e.g. all media in a room is quarantined. This is useful for sticker packs and other media that is uploaded by server administrators, but used by many people.
* Remove user's avatar URL and displayname when deactivated. (#8932)Dirk Klimpel2021-01-121-0/+220
| | | 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-6/+52
| | | | For remote users, only the rooms which the server knows about are returned. Local users have all of their joined rooms returned.
* Removes unnecessary declarations in the tests for the admin API. (#9063)Dirk Klimpel2021-01-116-17/+0
|
* Drop the unused local_invites table. (#8979)Patrick Cloke2020-12-291-1/+0
| | | This table has been unused since Synapse v1.17.0.
* Allow server admin to get admin bit in rooms where local user is an admin ↵Erik Johnston2020-12-181-0/+138
| | | | | | | (#8756) This adds an admin API that allows a server admin to get power in a room if a local user has power in a room. Will also invite the user if they're not in the room and its a private room. Can specify another user (rather than the admin user) to be granted power. Co-authored-by: Matthew Hodgson <matthew@matrix.org>
* Fix `UsersListTestCase` (#8964)Richard van der Hoff2020-12-171-6/+4
|
* Fix a bug that deactivated users appear in the directory (#8933)Dirk Klimpel2020-12-171-1/+49
| | | | | | | | | | Fixes a bug that deactivated users appear in the directory when their profile information was updated. To change profile information of deactivated users is neccesary for example you will remove displayname or avatar. But they should not appear in directory. They are deactivated. Co-authored-by: Erik Johnston <erikj@jki.re>
* Make search statement in List Room and User Admin API case-insensitive (#8931)Dirk Klimpel2020-12-172-3/+105
|
* Convert internal pusher dicts to attrs classes. (#8940)Patrick Cloke2020-12-161-1/+1
| | | This improves type hinting and should use less memory.
* Remove spurious "SynapseRequest" result from `make_request"Richard van der Hoff2020-12-157-441/+301
| | | | This was never used, so let's get rid of it.
* Add number of local devices to Room Details Admin API (#8886)Dirk Klimpel2020-12-111-0/+34
|
* Call set_avatar_url with target_user, not user_id (#8872)Will Hunt2020-12-071-1/+6
| | | | | | | | | | | | | | | | | | | | * 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 to pusher URLs. (#8865)Patrick Cloke2020-12-041-1/+1
| | | | Pusher URLs now must end in `/_matrix/push/v1/notify` per the specification.
* Apply an IP range blacklist to push and key revocation requests. (#8821)Patrick Cloke2020-12-021-1/+1
| | | | | | | | | | | | Replaces the `federation_ip_range_blacklist` configuration setting with an `ip_range_blacklist` setting with wider scope. It now applies to: * Federation * Identity servers * Push notifications * Checking key validitity for third-party invite events The old `federation_ip_range_blacklist` setting is still honored if present, but with reduced scope (it only applies to federation and identity servers).
* Fix broken testcase (#8851)Richard van der Hoff2020-12-011-1/+0
| | | | This test was broken by #8565. It doesn't need to set set `self.clock` here anyway - that is done by `setUp`.
* Remove deprecated `/_matrix/client/*/admin` endpoints (#8785)Dirk Klimpel2020-11-253-4/+112
| | | These are now only available via `/_synapse/admin/v1`.
* Fix tests on develop (#8777)Erik Johnston2020-11-181-16/+0
| | | This was broken due to #8617 and #8761.
* Merge pull request #8761 from matrix-org/rav/test_request_renderingRichard van der Hoff2020-11-177-278/+0
|\ | | | | Make `make_request` actually render the request
| * Remove redundant `HomeserverTestCase.render`Richard van der Hoff2020-11-167-266/+0
| |
| * Make `make_request` actually render the requestRichard van der Hoff2020-11-162-12/+0
| | | | | | | | | | | | remove the stubbing out of `request.process`, so that `requestReceived` also renders the request via the appropriate resource. Replace render() with a stub for now.
* | Add admin API for logging in as a user (#8617)Erik Johnston2020-11-171-2/+243
|/
* Merge branch 'develop' into rav/pass_site_to_make_requestRichard van der Hoff2020-11-161-1/+1
|\
| * Rename `create_test_json_resource` to `create_test_resource` (#8759)Richard van der Hoff2020-11-161-1/+1
| | | | | | | | | | The root resource isn't necessarily a JsonResource, so rename this method accordingly, and update a couple of test classes to use the method rather than directly manipulating self.resource.
* | use global make_request() directly where we have a custom ResourceRichard van der Hoff2020-11-152-7/+24
|/ | | | | | Where we want to render a request against a specific Resource, call the global make_request() function rather than the one in HomeserverTestCase, allowing us to pass in an appropriate `Site`.
* Add an admin API for users' media statistics (#8700)Dirk Klimpel2020-11-051-0/+485
| | | | | | | | Add `GET /_synapse/admin/v1/statistics/users/media` to get statisics about local media usage by users. Related to #6094 It is the first API for statistics. Goal is to avoid/reduce usage of sql queries like [Wiki analyzing Synapse](https://github.com/matrix-org/synapse/wiki/SQL-for-analyzing-Synapse-PostgreSQL-database-stats) Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Add `displayname` to Shared-Secret Registration for admins (#8722)Dirk Klimpel2020-11-051-2/+119
| | | Add `displayname` to Shared-Secret Registration for admins to `POST /_synapse/admin/v1/register`
* Consolidate purge table lists to prevent desyncronisation (#8713)Andrew Morgan2020-11-041-67/+38
| | | I idly noticed that these lists were out of sync with each other, causing us to miss a table in a test case (`local_invites`). Let's consolidate this list instead to prevent this from happening in the future.
* Fix unit tests (#8689)Erik Johnston2020-10-291-1/+1
| | | | | * Fix unit tests * Newsfile
* Add an admin APIs to allow server admins to list users' pushers (#8610)Dirk Klimpel2020-10-281-0/+124
| | | 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-0/+282
| | | Add admin API `GET /_synapse/admin/v1/users/<user_id>/media` to get information of users' uploaded files.
* Split admin API for reported events into a detail and a list view (#8539)Dirk Klimpel2020-10-261-13/+183
| | | | | | | | | | | | Split admin API for reported events in detail und list view. API was introduced with #8217 in synapse v.1.21.0. It makes the list (`GET /_synapse/admin/v1/event_reports`) less complex and provides a better overview. The details can be queried with: `GET /_synapse/admin/v1/event_reports/<report_id>`. It is similar to room and users API. It is a kind of regression in `GET /_synapse/admin/v1/event_reports`. `event_json` was removed. But the api was introduced one version before and it is an admin API (not under spec). Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Add an admin api to delete local media. (#8519)Dirk Klimpel2020-10-261-0/+568
| | | | | | Related to: #6459, #3479 Add `DELETE /_synapse/admin/v1/media/<server_name>/<media_id>` to delete a single file from server.
* Fix a bug in the joined_rooms admin API (#8643)Dirk Klimpel2020-10-261-1/+15
| | | | If the user was not in any rooms then the API returned the same error as if the user did not exist.
* Add field `total` to device list in admin API (#8644)Dirk Klimpel2020-10-261-0/+17
|
* Fixed a bug with reactivating users with the admin API (#8362)Dirk Klimpel2020-09-221-0/+14
| | | | | | | Fixes: #8359 Trying to reactivate a user with the admin API (`PUT /_synapse/admin/v2/users/<user_name>`) causes an internal server error. Seems to be a regression in #8033.
* Admin API for reported events (#8217)Dirk Klimpel2020-09-221-0/+382
| | | Add an admin API to read entries of table `event_reports`. API: `GET /_synapse/admin/v1/event_reports`
* Create function to check for long names in devices (#8364)Dionysis Grigoropoulos2020-09-221-1/+1
| | | | | | | | | * Create a new function to verify that the length of a device name is under a certain threshold. * Refactor old code and tests to use said function. * Verify device name length during registration of device * Add a test for the above Signed-off-by: Dionysis Grigoropoulos <dgrig@erethon.com>
* Admin API for querying rooms where a user is a member (#8306)Dirk Klimpel2020-09-181-2/+94
| | | | Add a new admin API `GET /_synapse/admin/v1/users/<user_id>/joined_rooms` to list all rooms where a user is a member.
* Add the topic and avatar to the room details admin API (#8305)Tulir Asokan2020-09-141-0/+2
|
* Allow for make_awaitable's return value to be re-used. (#8261)Patrick Cloke2020-09-081-3/+3
|
* Convert stats and related calls to async/await (#8192)Patrick Cloke2020-08-271-5/+4
|
* Convert synapse.api to async/await (#8031)Patrick Cloke2020-08-061-3/+7
|
* Rename database classes to make some sense (#8033)Erik Johnston2020-08-051-2/+2
|
* Convert federation client to async/await. (#7975)Patrick Cloke2020-07-301-2/+2
|
* Add an option to disable purge in delete room admin API (#7964)Dirk Klimpel2020-07-281-2/+55
| | | | | | Add option ```purge``` to ```POST /_synapse/admin/v1/rooms/<room_id>/delete``` Fixes: #3761 Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Convert tests/rest/admin/test_room.py to unix file endings (#7953)Andrew Morgan2020-07-271-1447/+1447
| | | | | Converts tests/rest/admin/test_room.py to have unix file endings after they were accidentally changed in #7613. Keeping the same changelog as #7613 as it hasn't gone out in a release yet.
* Add admin endpoint to get members in a room. (#7842)Michael Albert2020-07-161-0/+46
|
* Allow accounts to be re-activated from the admin APIs. (#7847)Patrick Cloke2020-07-151-0/+47
|
* Add delete room admin endpoint (#7613)Dirk Klimpel2020-07-141-0/+395
| | | | | | | | | | | | | | | | | | The Delete Room admin API allows server admins to remove rooms from server and block these rooms. `DELETE /_synapse/admin/v1/rooms/<room_id>` It is a combination and improvement of "[Shutdown room](https://github.com/matrix-org/synapse/blob/develop/docs/admin_api/shutdown_room.md)" and "[Purge room](https://github.com/matrix-org/synapse/blob/develop/docs/admin_api/purge_room.md)" API. Fixes: #6425 It also fixes a bug in [synapse/storage/data_stores/main/room.py](synapse/storage/data_stores/main/room.py) in ` get_room_with_stats`. It should return `None` if the room is unknown. But it returns an `IndexError`. https://github.com/matrix-org/synapse/blob/901b1fa561e3cc661d78aa96d59802cf2078cb0d/synapse/storage/data_stores/main/room.py#L99-L105 Related to: - #5575 - https://github.com/Awesome-Technologies/synapse-admin/issues/17 Signed-off-by: Dirk Klimpel dirk@klimpel.org
* Stop populating unused table `local_invites`. (#7793)Richard van der Hoff2020-07-071-1/+0
| | | | | This table is no longer used, so we may as well stop populating it. Removing it would prevent people rolling back to older releases of Synapse, so that can happen in a future release.
* Allow local media to be marked as safe from being quarantined. (#7718)Patrick Cloke2020-06-221-72/+65
|
* Allow new users to be registered via the admin API even if the monthly ↵Dirk Klimpel2020-06-051-15/+163
| | | | active user limit has been reached (#7263)
* Add device management to admin API (#7481)Dirk Klimpel2020-06-051-0/+541
| | | | | | | | | | - Admin is able to - change displaynames - delete devices - list devices - get device informations Fixes #7330
* Email notifications for new users when creating via the Admin API. (#7267)Dirk Klimpel2020-06-011-0/+75
|
* Add room details admin endpoint (#7317)Manuel Stahl2020-05-071-0/+41
|
* Return total number of users and profile attributes in admin users endpoint ↵Manuel Stahl2020-04-281-0/+2
| | | | | (#6881) Signed-off-by: Manuel Stahl <manuel.stahl@awesome-technologies.de>
* Extend room admin api with additional attributes (#7225)Dirk Klimpel2020-04-222-592/+680
|
* Admin API to join users to a room. (#7051)Dirk Klimpel2020-03-271-0/+288
|
* Remove special casing of `m.room.aliases` events (#7034)Patrick Cloke2020-03-171-0/+7
|
* Fixed set a user as an admin with the new API (#6928)Dirk Klimpel2020-02-281-32/+186
| | | Fix #6910
* Ensure 'deactivated' parameter is a boolean on user admin API, Fix error ↵Andrew Morgan2020-02-261-0/+59
| | | | handling of call to deactivate user (#6990)
* Return a 404 for admin api user lookup if user not found (#6901)Andrew Morgan2020-02-121-0/+16
|
* Admin api to add an email address (#6789)Dirk Klimpel2020-02-071-2/+17
|
* MSC2260: Block direct sends of m.room.aliases events (#6794)Richard van der Hoff2020-01-301-7/+0
| | | | | as per MSC2260
* Admin API to list, filter and sort rooms (#6720)Andrew Morgan2020-01-221-4/+389
|
* Fix and add test to deprecated quarantine media admin api (#6756)Andrew Morgan2020-01-221-4/+11
|
* Fix changing password via user admin API. (#6730)Erik Johnston2020-01-201-0/+13
|
* Fix purge_room admin API (#6711)Erik Johnston2020-01-151-3/+1
|
* Quarantine media by ID or user ID (#6681)Andrew Morgan2020-01-131-0/+341
|
* Allow admin users to create or modify users without a shared secret (#6495)Manuel Stahl2020-01-092-338/+465
| | | Signed-off-by: Manuel Stahl <manuel.stahl@awesome-technologies.de>
* Fix GET request on /_synapse/admin/v2/users endpoint (#6563)Manuel Stahl2020-01-081-0/+41
| | | | Fixes #6552
* Move DB pool and helper functions into dedicated Database classErik Johnston2019-12-051-1/+1
|
* Remove underscore from SQLBaseStore functionsErik Johnston2019-12-041-1/+1
|
* Blacklist PurgeRoomTestCase (#6361)Andrew Morgan2019-11-131-0/+2
|
* Fix deleting state groups during room purge.Erik Johnston2019-11-061-1/+3
| | | | And fix the tests to actually test that things got deleted.
* Add unit test for /purge_room APIErik Johnston2019-10-311-0/+78
|
* Fix races in room stats (and other) updates. (#6187)Richard van der Hoff2019-10-101-1/+1
| | | | | | | Hopefully this will fix the occasional failures we were seeing in the room directory. The problem was that events are not necessarily persisted (and `current_state_delta_stream` updated) in the same order as their stream_id. So for instance current_state_delta 9 might be persisted *before* current_state_delta 8. Then, when the room stats saw stream_id 9, it assumed it had done everything up to 9, and never came back to do stream_id 8. We can solve this easily by only processing up to the stream_id where we know all events have been persisted.
* Run Black. (#5482)Amber Brown2019-06-201-51/+49
|
* Unify v1 and v2 REST client APIs (#5226)Amber Brown2019-06-031-1/+0
|
* Run Black on the tests again (#5170)Amber Brown2019-05-101-70/+33
|
* Remove the requirement to authenticate for /admin/server_version. (#5122)Richard van der Hoff2019-05-071-22/+8
| | | | | | | | | This endpoint isn't much use for its intended purpose if you first need to get yourself an admin's auth token. I've restricted it to the `/_synapse/admin` path to make it a bit easier to lock down for those concerned about exposing this information. I don't imagine anyone is using it in anger currently.
* Add admin api for sending server_notices (#5121)Richard van der Hoff2019-05-021-4/+4
|
* Move admin api impl to its own packageRichard van der Hoff2019-05-012-0/+631
It doesn't really belong under rest/client/v1 any more.