Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/ma…
Browse files Browse the repository at this point in the history
…ke_database_class
  • Loading branch information
erikjohnston committed Dec 6, 2019
2 parents e216ec3 + 649b6bc commit 2ace775
Show file tree
Hide file tree
Showing 56 changed files with 766 additions and 823 deletions.
2 changes: 1 addition & 1 deletion .buildkite/postgres-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Configuration file used for testing the 'synapse_port_db' script.
# Tells the script to connect to the postgresql database that will be available in the
# CI's Docker setup at the point where this file is considered.
server_name: "localhost:8080"
server_name: "test"

signing_key_path: "/src/.buildkite/test.signing.key"

Expand Down
2 changes: 1 addition & 1 deletion .buildkite/sqlite-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Configuration file used for testing the 'synapse_port_db' script.
# Tells the 'update_database' script to connect to the test SQLite database to upgrade its
# schema and run background updates on it.
server_name: "localhost:8080"
server_name: "test"

signing_key_path: "/src/.buildkite/test.signing.key"

Expand Down
1 change: 1 addition & 0 deletions changelog.d/5925.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add admin/v2/users endpoint with pagination. Contributed by Awesome Technologies Innovationslabor GmbH.
1 change: 1 addition & 0 deletions changelog.d/5925.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove admin/v1/users_paginate endpoint. Contributed by Awesome Technologies Innovationslabor GmbH.
1 change: 1 addition & 0 deletions changelog.d/6369.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update documentation and variables in user contributed systemd reference file.
1 change: 1 addition & 0 deletions changelog.d/6472.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve sanity-checking when receiving events over federation.
1 change: 1 addition & 0 deletions changelog.d/6480.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Refactor some code in the event authentication path for clarity.
1 change: 1 addition & 0 deletions changelog.d/6482.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Port synapse.rest.client.v1 to async/await.
1 change: 1 addition & 0 deletions changelog.d/6483.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Port synapse.rest.client.v2_alpha to async/await.
17 changes: 17 additions & 0 deletions contrib/systemd/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Setup Synapse with Systemd
This is a setup for managing synapse with a user contributed systemd unit
file. It provides a `matrix-synapse` systemd unit file that should be tailored
to accommodate your installation in accordance with the installation
instructions provided in [installation instructions](../../INSTALL.md).

## Setup
1. Under the service section, ensure the `User` variable matches which user
you installed synapse under and wish to run it as.
2. Under the service section, ensure the `WorkingDirectory` variable matches
where you have installed synapse.
3. Under the service section, ensure the `ExecStart` variable matches the
appropriate locations of your installation.
4. Copy the `matrix-synapse.service` to `/etc/systemd/system/`
5. Start Synapse: `sudo systemctl start matrix-synapse`
6. Verify Synapse is running: `sudo systemctl status matrix-synapse`
7. *optional* Enable Synapse to start at system boot: `sudo systemctl enable matrix-synapse`
7 changes: 5 additions & 2 deletions contrib/systemd/matrix-synapse.service
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
# systemctl enable matrix-synapse
# systemctl start matrix-synapse
#
# This assumes that Synapse has been installed by a user named
# synapse.
#
# This assumes that Synapse has been installed in a virtualenv in
# /opt/synapse/env.
# the user's home directory: `/home/synapse/synapse/env`.
#
# **NOTE:** This is an example service file that may change in the future. If you
# wish to use this please copy rather than symlink it.
Expand All @@ -23,7 +26,7 @@ User=synapse
Group=nogroup

WorkingDirectory=/opt/synapse
ExecStart=/opt/synapse/env/bin/python -m synapse.app.homeserver --config-path=/opt/synapse/homeserver.yaml
ExecStart=/home/synapse/synapse/env/bin/python -m synapse.app.homeserver --config-path=/home/synapse/synapse/homeserver.yaml
SyslogIdentifier=matrix-synapse

# adjust the cache factor if necessary
Expand Down
45 changes: 45 additions & 0 deletions docs/admin_api/user_admin_api.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
List Accounts
=============

This API returns all local user accounts.

The api is::

GET /_synapse/admin/v2/users?from=0&limit=10&guests=false

including an ``access_token`` of a server admin.
The parameters ``from`` and ``limit`` are required only for pagination.
By default, a ``limit`` of 100 is used.
The parameter ``user_id`` can be used to select only users with user ids that
contain this value.
The parameter ``guests=false`` can be used to exclude guest users,
default is to include guest users.
The parameter ``deactivated=true`` can be used to include deactivated users,
default is to exclude deactivated users.
If the endpoint does not return a ``next_token`` then there are no more users left.
It returns a JSON body like the following:

.. code:: json
{
"users": [
{
"name": "<user_id1>",
"password_hash": "<password_hash1>",
"is_guest": 0,
"admin": 0,
"user_type": null,
"deactivated": 0
}, {
"name": "<user_id2>",
"password_hash": "<password_hash2>",
"is_guest": 0,
"admin": 1,
"user_type": null,
"deactivated": 0
}
],
"next_token": "100"
}
Query Account
=============

Expand Down
2 changes: 1 addition & 1 deletion synapse/app/synchrotron.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def send_stop_syncing(self):

def set_state(self, user, state, ignore_status_msg=False):
# TODO Hows this supposed to work?
pass
return defer.succeed(None)

get_states = __func__(PresenceHandler.get_states)
get_state = __func__(PresenceHandler.get_state)
Expand Down
21 changes: 12 additions & 9 deletions synapse/handlers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def get_whois(self, user):

@defer.inlineCallbacks
def get_users(self):
"""Function to reterive a list of users in users table.
"""Function to retrieve a list of users in users table.
Args:
Returns:
Expand All @@ -67,19 +67,22 @@ def get_users(self):
return ret

@defer.inlineCallbacks
def get_users_paginate(self, order, start, limit):
"""Function to reterive a paginated list of users from
users list. This will return a json object, which contains
list of users and the total number of users in users table.
def get_users_paginate(self, start, limit, name, guests, deactivated):
"""Function to retrieve a paginated list of users from
users list. This will return a json list of users.
Args:
order (str): column name to order the select by this column
start (int): start number to begin the query from
limit (int): number of rows to reterive
limit (int): number of rows to retrieve
name (string): filter for user names
guests (bool): whether to in include guest users
deactivated (bool): whether to include deactivated users
Returns:
defer.Deferred: resolves to json object {list[dict[str, Any]], count}
defer.Deferred: resolves to json list[dict[str, Any]]
"""
ret = yield self.store.get_users_paginate(order, start, limit)
ret = yield self.store.get_users_paginate(
start, limit, name, guests, deactivated
)

return ret

Expand Down
Loading

0 comments on commit 2ace775

Please sign in to comment.