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
99bbe177
Commit
99bbe177
authored
5 years ago
by
dklimpel
Browse files
Options
Downloads
Patches
Plain Diff
add disable_3pid_changes
parent
20545a21
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
docs/sample_config.yaml
+5
-0
5 additions, 0 deletions
docs/sample_config.yaml
synapse/config/registration.py
+6
-0
6 additions, 0 deletions
synapse/config/registration.py
synapse/rest/client/v2_alpha/account.py
+10
-0
10 additions, 0 deletions
synapse/rest/client/v2_alpha/account.py
with
21 additions
and
0 deletions
docs/sample_config.yaml
+
5
−
0
View file @
99bbe177
...
@@ -1065,6 +1065,11 @@ account_threepid_delegates:
...
@@ -1065,6 +1065,11 @@ account_threepid_delegates:
#disable_set_displayname: false
#disable_set_displayname: false
#disable_set_avatar_url: false
#disable_set_avatar_url: false
# If true, stop users from trying to change the 3PIDs associated with
# their accounts.
#
#disable_3pid_changes: false
# Users who register on this homeserver will automatically be joined
# Users who register on this homeserver will automatically be joined
# to these rooms
# to these rooms
#
#
...
...
This diff is collapsed.
Click to expand it.
synapse/config/registration.py
+
6
−
0
View file @
99bbe177
...
@@ -131,6 +131,7 @@ class RegistrationConfig(Config):
...
@@ -131,6 +131,7 @@ class RegistrationConfig(Config):
self
.
disable_set_displayname
=
config
.
get
(
"
disable_set_displayname
"
,
False
)
self
.
disable_set_displayname
=
config
.
get
(
"
disable_set_displayname
"
,
False
)
self
.
disable_set_avatar_url
=
config
.
get
(
"
disable_set_avatar_url
"
,
False
)
self
.
disable_set_avatar_url
=
config
.
get
(
"
disable_set_avatar_url
"
,
False
)
self
.
disable_3pid_changes
=
config
.
get
(
"
disable_3pid_changes
"
,
False
)
self
.
disable_msisdn_registration
=
config
.
get
(
self
.
disable_msisdn_registration
=
config
.
get
(
"
disable_msisdn_registration
"
,
False
"
disable_msisdn_registration
"
,
False
...
@@ -341,6 +342,11 @@ class RegistrationConfig(Config):
...
@@ -341,6 +342,11 @@ class RegistrationConfig(Config):
#disable_set_displayname: false
#disable_set_displayname: false
#disable_set_avatar_url: false
#disable_set_avatar_url: false
# If true, stop users from trying to change the 3PIDs associated with
# their accounts.
#
#disable_3pid_changes: false
# Users who register on this homeserver will automatically be joined
# Users who register on this homeserver will automatically be joined
# to these rooms
# to these rooms
#
#
...
...
This diff is collapsed.
Click to expand it.
synapse/rest/client/v2_alpha/account.py
+
10
−
0
View file @
99bbe177
...
@@ -599,6 +599,9 @@ class ThreepidRestServlet(RestServlet):
...
@@ -599,6 +599,9 @@ class ThreepidRestServlet(RestServlet):
return
200
,
{
"
threepids
"
:
threepids
}
return
200
,
{
"
threepids
"
:
threepids
}
async
def
on_POST
(
self
,
request
):
async
def
on_POST
(
self
,
request
):
if
self
.
hs
.
config
.
disable_3pid_changes
:
raise
SynapseError
(
400
,
"
3PID changes disabled on this server
"
)
requester
=
await
self
.
auth
.
get_user_by_req
(
request
)
requester
=
await
self
.
auth
.
get_user_by_req
(
request
)
user_id
=
requester
.
user
.
to_string
()
user_id
=
requester
.
user
.
to_string
()
body
=
parse_json_object_from_request
(
request
)
body
=
parse_json_object_from_request
(
request
)
...
@@ -643,6 +646,9 @@ class ThreepidAddRestServlet(RestServlet):
...
@@ -643,6 +646,9 @@ class ThreepidAddRestServlet(RestServlet):
@interactive_auth_handler
@interactive_auth_handler
async
def
on_POST
(
self
,
request
):
async
def
on_POST
(
self
,
request
):
if
self
.
hs
.
config
.
disable_3pid_changes
:
raise
SynapseError
(
400
,
"
3PID changes disabled on this server
"
)
requester
=
await
self
.
auth
.
get_user_by_req
(
request
)
requester
=
await
self
.
auth
.
get_user_by_req
(
request
)
user_id
=
requester
.
user
.
to_string
()
user_id
=
requester
.
user
.
to_string
()
body
=
parse_json_object_from_request
(
request
)
body
=
parse_json_object_from_request
(
request
)
...
@@ -738,10 +744,14 @@ class ThreepidDeleteRestServlet(RestServlet):
...
@@ -738,10 +744,14 @@ class ThreepidDeleteRestServlet(RestServlet):
def
__init__
(
self
,
hs
):
def
__init__
(
self
,
hs
):
super
(
ThreepidDeleteRestServlet
,
self
).
__init__
()
super
(
ThreepidDeleteRestServlet
,
self
).
__init__
()
self
.
hs
=
hs
self
.
auth
=
hs
.
get_auth
()
self
.
auth
=
hs
.
get_auth
()
self
.
auth_handler
=
hs
.
get_auth_handler
()
self
.
auth_handler
=
hs
.
get_auth_handler
()
async
def
on_POST
(
self
,
request
):
async
def
on_POST
(
self
,
request
):
if
self
.
hs
.
config
.
disable_3pid_changes
:
raise
SynapseError
(
400
,
"
3PID changes disabled on this server
"
)
body
=
parse_json_object_from_request
(
request
)
body
=
parse_json_object_from_request
(
request
)
assert_params_in_dict
(
body
,
[
"
medium
"
,
"
address
"
])
assert_params_in_dict
(
body
,
[
"
medium
"
,
"
address
"
])
...
...
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