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
9c3f4f8d
Commit
9c3f4f8d
authored
9 years ago
by
Daniel Wagner-Hall
Browse files
Options
Downloads
Patches
Plain Diff
Allow guests to /room/:room_id/{join,leave}
parent
e4d622aa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
synapse/rest/client/v1/room.py
+14
-3
14 additions, 3 deletions
synapse/rest/client/v1/room.py
with
14 additions
and
3 deletions
synapse/rest/client/v1/room.py
+
14
−
3
View file @
9c3f4f8d
...
...
@@ -17,7 +17,7 @@
from
twisted.internet
import
defer
from
base
import
ClientV1RestServlet
,
client_path_pattern
from
synapse.api.errors
import
SynapseError
,
Codes
from
synapse.api.errors
import
SynapseError
,
Codes
,
AuthError
from
synapse.streams.config
import
PaginationConfig
from
synapse.api.constants
import
EventTypes
,
Membership
from
synapse.types
import
UserID
,
RoomID
,
RoomAlias
...
...
@@ -453,7 +453,13 @@ class RoomMembershipRestServlet(ClientV1RestServlet):
@defer.inlineCallbacks
def
on_POST
(
self
,
request
,
room_id
,
membership_action
,
txn_id
=
None
):
user
,
token_id
,
_
=
yield
self
.
auth
.
get_user_by_req
(
request
)
user
,
token_id
,
is_guest
=
yield
self
.
auth
.
get_user_by_req
(
request
,
allow_guest
=
True
)
if
is_guest
and
membership_action
not
in
{
Membership
.
JOIN
,
Membership
.
LEAVE
}:
raise
AuthError
(
403
,
"
Guest access not allowed
"
)
content
=
_parse_json
(
request
)
...
...
@@ -486,16 +492,21 @@ class RoomMembershipRestServlet(ClientV1RestServlet):
msg_handler
=
self
.
handlers
.
message_handler
content
=
{
"
membership
"
:
unicode
(
membership_action
)}
if
is_guest
:
content
[
"
kind
"
]
=
"
guest
"
yield
msg_handler
.
create_and_send_event
(
{
"
type
"
:
EventTypes
.
Member
,
"
content
"
:
{
"
membership
"
:
unicode
(
membership_action
)}
,
"
content
"
:
content
,
"
room_id
"
:
room_id
,
"
sender
"
:
user
.
to_string
(),
"
state_key
"
:
state_key
,
},
token_id
=
token_id
,
txn_id
=
txn_id
,
is_guest
=
is_guest
,
)
defer
.
returnValue
((
200
,
{}))
...
...
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