Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
aacd15ef
Commit
aacd15ef
authored
Jun 20, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[OK] import/export terms table: check user credentials before change
parent
307df5c3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
ngramlists.py
gargantext/views/api/ngramlists.py
+10
-2
No files found.
gargantext/views/api/ngramlists.py
View file @
aacd15ef
...
...
@@ -66,14 +66,22 @@ class CSVLists(APIView):
/!
\
We assume we checked the file size client-side before upload
£TODO check authentication and user.id
"""
if
not
request
.
user
.
is_authenticated
():
res
=
HttpResponse
(
"Unauthorized"
)
res
.
status_code
=
401
return
res
# this time the corpus param is the one with the target lists to be patched
params
=
get_parameters
(
request
)
corpus_id
=
int
(
params
.
pop
(
"onto_corpus"
))
corpus_node
=
cache
.
Node
[
corpus_id
]
if
request
.
user
.
id
!=
corpus_node
.
user_id
:
res
=
HttpResponse
(
"Unauthorized"
)
res
.
status_code
=
401
return
res
# request also contains the file
# csv_file has type django.core.files.uploadedfile.InMemoryUploadedFile
# ----------------------
...
...
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