Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
1e788db4
Commit
1e788db4
authored
6 years ago
by
Matthew Hodgson
Browse files
Options
Downloads
Patches
Plain Diff
add GDPR erase param to deactivate API
parent
784189b1
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/deactivate_account.py
+1
-0
1 addition, 0 deletions
synapse/handlers/deactivate_account.py
synapse/rest/client/v1/admin.py
+12
-1
12 additions, 1 deletion
synapse/rest/client/v1/admin.py
with
13 additions
and
1 deletion
synapse/handlers/deactivate_account.py
+
1
−
0
View file @
1e788db4
...
...
@@ -47,6 +47,7 @@ class DeactivateAccountHandler(BaseHandler):
Args:
user_id (str): ID of user to be deactivated
erase_data (bool): whether to GDPR-erase the user
'
s data
Returns:
Deferred
...
...
This diff is collapsed.
Click to expand it.
synapse/rest/client/v1/admin.py
+
12
−
1
View file @
1e788db4
...
...
@@ -16,6 +16,8 @@
from
twisted.internet
import
defer
from
six.moves
import
http_client
from
synapse.api.constants
import
Membership
from
synapse.api.errors
import
AuthError
,
SynapseError
,
Codes
,
NotFoundError
from
synapse.types
import
UserID
,
create_requester
...
...
@@ -247,6 +249,15 @@ class DeactivateAccountRestServlet(ClientV1RestServlet):
@defer.inlineCallbacks
def
on_POST
(
self
,
request
,
target_user_id
):
body
=
parse_json_object_from_request
(
request
)
erase
=
body
.
get
(
"
erase
"
,
False
)
if
not
isinstance
(
erase
,
bool
):
raise
SynapseError
(
http_client
.
BAD_REQUEST
,
"
Param
'
erase
'
must be a boolean, if given
"
,
Codes
.
BAD_JSON
,
)
UserID
.
from_string
(
target_user_id
)
requester
=
yield
self
.
auth
.
get_user_by_req
(
request
)
is_admin
=
yield
self
.
auth
.
is_server_admin
(
requester
.
user
)
...
...
@@ -255,7 +266,7 @@ class DeactivateAccountRestServlet(ClientV1RestServlet):
raise
AuthError
(
403
,
"
You are not a server admin
"
)
yield
self
.
_deactivate_account_handler
.
deactivate_account
(
target_user_id
,
Fal
se
,
target_user_id
,
era
se
,
)
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