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
526bc33e
Commit
526bc33e
authored
9 years ago
by
Daniel Wagner-Hall
Browse files
Options
Downloads
Patches
Plain Diff
Fix implementation of /admin/whois
parent
f721fdbf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/handlers/admin.py
+11
-17
11 additions, 17 deletions
synapse/handlers/admin.py
synapse/rest/client/v1/admin.py
+1
-1
1 addition, 1 deletion
synapse/rest/client/v1/admin.py
with
12 additions
and
18 deletions
synapse/handlers/admin.py
+
11
−
17
View file @
526bc33e
...
@@ -30,33 +30,27 @@ class AdminHandler(BaseHandler):
...
@@ -30,33 +30,27 @@ class AdminHandler(BaseHandler):
@defer.inlineCallbacks
@defer.inlineCallbacks
def
get_whois
(
self
,
user
):
def
get_whois
(
self
,
user
):
res
=
yield
self
.
store
.
get_user_ip_and_agents
(
user
)
connections
=
[]
d
=
{}
sessions
=
yield
self
.
store
.
get_user_ip_and_agents
(
user
)
for
r
in
res
:
for
session
in
sessions
:
# Note that device_id is always None
connections
.
append
({
device
=
d
.
setdefault
(
r
[
"
device_id
"
],
{})
"
ip
"
:
session
[
"
ip
"
],
session
=
device
.
setdefault
(
r
[
"
access_token
"
],
[])
"
last_seen
"
:
session
[
"
last_seen
"
],
session
.
append
({
"
user_agent
"
:
session
[
"
user_agent
"
],
"
ip
"
:
r
[
"
ip
"
],
"
user_agent
"
:
r
[
"
user_agent
"
],
"
last_seen
"
:
r
[
"
last_seen
"
],
})
})
ret
=
{
ret
=
{
"
user_id
"
:
user
.
to_string
(),
"
user_id
"
:
user
.
to_string
(),
"
devices
"
:
[
"
devices
"
:
[
{
{
"
device_id
"
:
k
,
"
device_id
"
:
None
,
"
sessions
"
:
[
"
sessions
"
:
[
{
{
# "access_token": x, TODO (erikj)
"
connections
"
:
connections
,
"
connections
"
:
y
,
}
}
for
x
,
y
in
v
.
items
()
]
]
}
},
for
k
,
v
in
d
.
items
()
],
],
}
}
...
...
This diff is collapsed.
Click to expand it.
synapse/rest/client/v1/admin.py
+
1
−
1
View file @
526bc33e
...
@@ -26,7 +26,7 @@ logger = logging.getLogger(__name__)
...
@@ -26,7 +26,7 @@ logger = logging.getLogger(__name__)
class
WhoisRestServlet
(
ClientV1RestServlet
):
class
WhoisRestServlet
(
ClientV1RestServlet
):
PATTERNS
=
client_path_patterns
(
"
/admin/whois/(?P<user_id>[^/]*)
"
,
releases
=
()
)
PATTERNS
=
client_path_patterns
(
"
/admin/whois/(?P<user_id>[^/]*)
"
)
@defer.inlineCallbacks
@defer.inlineCallbacks
def
on_GET
(
self
,
request
,
user_id
):
def
on_GET
(
self
,
request
,
user_id
):
...
...
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