Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Openlobby Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
openlobby
Openlobby Server
Commits
3162d6a7
Commit
3162d6a7
authored
Dec 4, 2017
by
jan.bednarik
Browse files
Options
Downloads
Patches
Plain Diff
Logout mutation.
parent
50d90895
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
openlobby/mutations.py
+18
-0
18 additions, 0 deletions
openlobby/mutations.py
with
18 additions
and
0 deletions
openlobby/mutations.py
+
18
−
0
View file @
3162d6a7
import
arrow
from
flask
import
g
import
graphene
from
graphene
import
relay
from
graphene.types.datetime
import
DateTime
...
...
@@ -130,6 +131,22 @@ class LoginRedirect(relay.ClientIDMutation):
return
LoginRedirect
(
access_token
=
token
)
class
Logout
(
relay
.
ClientIDMutation
):
success
=
graphene
.
Boolean
()
@classmethod
def
mutate_and_get_payload
(
cls
,
root
,
info
,
**
input
):
viewer
=
get_viewer
(
info
)
if
viewer
is
None
:
raise
Exception
(
'
User must be logged in to perform this mutation.
'
)
session_id
=
g
.
get
(
'
session_id
'
)
session
=
SessionDoc
.
get
(
session_id
,
using
=
info
.
context
[
'
es
'
],
index
=
info
.
context
[
'
index
'
])
session
.
delete
(
using
=
info
.
context
[
'
es
'
],
index
=
info
.
context
[
'
index
'
])
return
Logout
(
success
=
True
)
class
NewReport
(
relay
.
ClientIDMutation
):
class
Input
:
...
...
@@ -168,4 +185,5 @@ class NewReport(relay.ClientIDMutation):
class
Mutation
(
graphene
.
ObjectType
):
login
=
Login
.
Field
()
login_redirect
=
LoginRedirect
.
Field
()
logout
=
Logout
.
Field
()
new_report
=
NewReport
.
Field
()
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