Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
feudalBackend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
feudal
feudalBackend
Commits
c3581df8
Commit
c3581df8
authored
Mar 12, 2018
by
Lukas Burgey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement user deletion
parent
cdcb9386
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
2 deletions
+11
-2
django_backend/backend/frontend/urls.py
django_backend/backend/frontend/urls.py
+1
-0
django_backend/backend/frontend/views.py
django_backend/backend/frontend/views.py
+8
-0
django_backend/backend/models.py
django_backend/backend/models.py
+2
-2
No files found.
django_backend/backend/frontend/urls.py
View file @
c3581df8
...
...
@@ -5,4 +5,5 @@ URLPATTERNS = [
url
(
r
'^state/'
,
views
.
StateView
.
as_view
()),
url
(
r
'^sshkey/'
,
views
.
SSHPublicKeyView
.
as_view
()),
url
(
r
'^deployments/'
,
views
.
DeploymentView
.
as_view
()),
url
(
r
'^delete_user/'
,
views
.
UserDeletionView
.
as_view
()),
]
django_backend/backend/frontend/views.py
View file @
c3581df8
import
logging
from
django.shortcuts
import
get_object_or_404
from
django.core.exceptions
import
ObjectDoesNotExist
from
django.contrib.auth
import
logout
from
rest_framework
import
views
,
viewsets
from
rest_framework.permissions
import
AllowAny
from
rest_framework.response
import
Response
...
...
@@ -128,3 +129,10 @@ class DeploymentView(views.APIView):
deployment
.
save
()
return
_api_state_response
(
request
)
class
UserDeletionView
(
views
.
APIView
):
def
delete
(
self
,
request
):
# this also logs out the user
request
.
user
.
remove
()
logout
(
request
)
return
_api_state_response
(
request
)
django_backend/backend/models.py
View file @
c3581df8
...
...
@@ -341,11 +341,11 @@ class User(AbstractUser):
def
remove
(
self
):
if
self
.
user_type
==
'oidcuser'
:
self
.
deactivate
()
LOGGER
.
info
(
self
.
_msg
(
'Deleting'
))
#
TODO
: deleting the user brings problems:
#
FIXME
: deleting the user brings problems:
# the deletion cascades down to DeploymentTask and DeploymentTaskItem
# but these need to be conserved so all clients withdrawals can be tracked
LOGGER
.
info
(
self
.
_msg
(
'Deleting'
))
self
.
delete
()
def
activate
(
self
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment