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
4cc4400b
Commit
4cc4400b
authored
6 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Split /login into client_reader
parent
af691e41
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
synapse/app/client_reader.py
+2
-0
2 additions, 0 deletions
synapse/app/client_reader.py
synapse/storage/registration.py
+41
-41
41 additions, 41 deletions
synapse/storage/registration.py
with
43 additions
and
41 deletions
synapse/app/client_reader.py
+
2
−
0
View file @
4cc4400b
...
...
@@ -40,6 +40,7 @@ from synapse.replication.slave.storage.registration import SlavedRegistrationSto
from
synapse.replication.slave.storage.room
import
RoomStore
from
synapse.replication.slave.storage.transactions
import
SlavedTransactionStore
from
synapse.replication.tcp.client
import
ReplicationClientHandler
from
synapse.rest.client.v1.login
import
LoginRestServlet
from
synapse.rest.client.v1.room
import
(
JoinedRoomMemberListRestServlet
,
PublicRoomListRestServlet
,
...
...
@@ -94,6 +95,7 @@ class ClientReaderServer(HomeServer):
RoomStateRestServlet
(
self
).
register
(
resource
)
RoomEventContextServlet
(
self
).
register
(
resource
)
RegisterRestServlet
(
self
).
register
(
resource
)
LoginRestServlet
(
self
).
register
(
resource
)
resources
.
update
({
"
/_matrix/client/r0
"
:
resource
,
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/registration.py
+
41
−
41
View file @
4cc4400b
...
...
@@ -254,6 +254,47 @@ class RegistrationWorkerStore(SQLBaseStore):
defer
.
returnValue
(
ret
[
"
guest_access_token
"
])
defer
.
returnValue
(
None
)
@defer.inlineCallbacks
def
get_user_id_by_threepid
(
self
,
medium
,
address
):
"""
Returns user id from threepid
Args:
medium (str): threepid medium e.g. email
address (str): threepid address e.g. me@example.com
Returns:
Deferred[str|None]: user id or None if no user id/threepid mapping exists
"""
user_id
=
yield
self
.
runInteraction
(
"
get_user_id_by_threepid
"
,
self
.
get_user_id_by_threepid_txn
,
medium
,
address
)
defer
.
returnValue
(
user_id
)
def
get_user_id_by_threepid_txn
(
self
,
txn
,
medium
,
address
):
"""
Returns user id from threepid
Args:
txn (cursor):
medium (str): threepid medium e.g. email
address (str): threepid address e.g. me@example.com
Returns:
str|None: user id or None if no user id/threepid mapping exists
"""
ret
=
self
.
_simple_select_one_txn
(
txn
,
"
user_threepids
"
,
{
"
medium
"
:
medium
,
"
address
"
:
address
},
[
'
user_id
'
],
True
)
if
ret
:
return
ret
[
'
user_id
'
]
return
None
class
RegistrationStore
(
RegistrationWorkerStore
,
background_updates
.
BackgroundUpdateStore
):
...
...
@@ -613,47 +654,6 @@ class RegistrationStore(RegistrationWorkerStore,
)
defer
.
returnValue
(
ret
)
@defer.inlineCallbacks
def
get_user_id_by_threepid
(
self
,
medium
,
address
):
"""
Returns user id from threepid
Args:
medium (str): threepid medium e.g. email
address (str): threepid address e.g. me@example.com
Returns:
Deferred[str|None]: user id or None if no user id/threepid mapping exists
"""
user_id
=
yield
self
.
runInteraction
(
"
get_user_id_by_threepid
"
,
self
.
get_user_id_by_threepid_txn
,
medium
,
address
)
defer
.
returnValue
(
user_id
)
def
get_user_id_by_threepid_txn
(
self
,
txn
,
medium
,
address
):
"""
Returns user id from threepid
Args:
txn (cursor):
medium (str): threepid medium e.g. email
address (str): threepid address e.g. me@example.com
Returns:
str|None: user id or None if no user id/threepid mapping exists
"""
ret
=
self
.
_simple_select_one_txn
(
txn
,
"
user_threepids
"
,
{
"
medium
"
:
medium
,
"
address
"
:
address
},
[
'
user_id
'
],
True
)
if
ret
:
return
ret
[
'
user_id
'
]
return
None
def
user_delete_threepid
(
self
,
user_id
,
medium
,
address
):
return
self
.
_simple_delete
(
"
user_threepids
"
,
...
...
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