Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Maunium
synapse
Commits
7caaa29d
Commit
7caaa29d
authored
5 years ago
by
Manuel Stahl
Committed by
Richard van der Hoff
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix GET request on /_synapse/admin/v2/users endpoint (#6563)
Fixes #6552
parent
573fee75
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
changelog.d/6563.bugfix
+1
-0
1 addition, 0 deletions
changelog.d/6563.bugfix
synapse/storage/data_stores/main/__init__.py
+2
-2
2 additions, 2 deletions
synapse/storage/data_stores/main/__init__.py
tests/rest/admin/test_admin.py
+41
-0
41 additions, 0 deletions
tests/rest/admin/test_admin.py
with
44 additions
and
2 deletions
changelog.d/6563.bugfix
0 → 100644
+
1
−
0
View file @
7caaa29d
Fix GET request on /_synapse/admin/v2/users endpoint. Contributed by Awesome Technologies Innovationslabor GmbH.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
synapse/storage/data_stores/main/__init__.py
+
2
−
2
View file @
7caaa29d
...
@@ -526,9 +526,9 @@ class DataStore(
...
@@ -526,9 +526,9 @@ class DataStore(
attr_filter
=
{}
attr_filter
=
{}
if
not
guests
:
if
not
guests
:
attr_filter
[
"
is_guest
"
]
=
False
attr_filter
[
"
is_guest
"
]
=
0
if
not
deactivated
:
if
not
deactivated
:
attr_filter
[
"
deactivated
"
]
=
False
attr_filter
[
"
deactivated
"
]
=
0
return
self
.
db
.
simple_select_list_paginate
(
return
self
.
db
.
simple_select_list_paginate
(
desc
=
"
get_users_paginate
"
,
desc
=
"
get_users_paginate
"
,
...
...
This diff is collapsed.
Click to expand it.
tests/rest/admin/test_admin.py
+
41
−
0
View file @
7caaa29d
...
@@ -341,6 +341,47 @@ class UserRegisterTestCase(unittest.HomeserverTestCase):
...
@@ -341,6 +341,47 @@ class UserRegisterTestCase(unittest.HomeserverTestCase):
self
.
assertEqual
(
"
Invalid user type
"
,
channel
.
json_body
[
"
error
"
])
self
.
assertEqual
(
"
Invalid user type
"
,
channel
.
json_body
[
"
error
"
])
class
UsersListTestCase
(
unittest
.
HomeserverTestCase
):
servlets
=
[
synapse
.
rest
.
admin
.
register_servlets
,
login
.
register_servlets
,
]
url
=
"
/_synapse/admin/v2/users
"
def
prepare
(
self
,
reactor
,
clock
,
hs
):
self
.
admin_user
=
self
.
register_user
(
"
admin
"
,
"
pass
"
,
admin
=
True
)
self
.
admin_user_tok
=
self
.
login
(
"
admin
"
,
"
pass
"
)
self
.
register_user
(
"
user1
"
,
"
pass1
"
,
admin
=
False
)
self
.
register_user
(
"
user2
"
,
"
pass2
"
,
admin
=
False
)
def
test_no_auth
(
self
):
"""
Try to list users without authentication.
"""
request
,
channel
=
self
.
make_request
(
"
GET
"
,
self
.
url
,
b
"
{}
"
)
self
.
render
(
request
)
self
.
assertEqual
(
401
,
int
(
channel
.
result
[
"
code
"
]),
msg
=
channel
.
result
[
"
body
"
])
self
.
assertEqual
(
"
M_MISSING_TOKEN
"
,
channel
.
json_body
[
"
errcode
"
])
def
test_all_users
(
self
):
"""
List all users, including deactivated users.
"""
request
,
channel
=
self
.
make_request
(
"
GET
"
,
self
.
url
+
"
?deactivated=true
"
,
b
"
{}
"
,
access_token
=
self
.
admin_user_tok
,
)
self
.
render
(
request
)
self
.
assertEqual
(
200
,
int
(
channel
.
result
[
"
code
"
]),
msg
=
channel
.
result
[
"
body
"
])
self
.
assertEqual
(
3
,
len
(
channel
.
json_body
[
"
users
"
]))
class
ShutdownRoomTestCase
(
unittest
.
HomeserverTestCase
):
class
ShutdownRoomTestCase
(
unittest
.
HomeserverTestCase
):
servlets
=
[
servlets
=
[
synapse
.
rest
.
admin
.
register_servlets_for_client_rest_resource
,
synapse
.
rest
.
admin
.
register_servlets_for_client_rest_resource
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment