mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-01-12 19:20:34 +00:00
Change the verification, it a user is allowed to view a corpus_file
This commit is contained in:
parent
8cc748de94
commit
c3c3b70030
@ -242,12 +242,12 @@ def download_corpus_file(corpus_id, corpus_file_id):
|
|||||||
methods=['GET', 'POST'])
|
methods=['GET', 'POST'])
|
||||||
@login_required
|
@login_required
|
||||||
def corpus_file(corpus_id, corpus_file_id):
|
def corpus_file(corpus_id, corpus_file_id):
|
||||||
corpus_file = CorpusFile.query.get_or_404(corpus_file_id)
|
corpus = Corpus.query.get_or_404(corpus_id)
|
||||||
if corpus_file.corpus_id != corpus_id:
|
if not (corpus.creator == current_user or current_user.is_administrator()):
|
||||||
abort(404)
|
|
||||||
if not (corpus_file.corpus.creator == current_user
|
|
||||||
or current_user.is_administrator()):
|
|
||||||
abort(403)
|
abort(403)
|
||||||
|
corpus_file = CorpusFile.query.get_or_404(corpus_file_id)
|
||||||
|
if corpus_file.corpus != corpus:
|
||||||
|
abort(404)
|
||||||
form = EditCorpusFileForm(prefix='edit-corpus-file-form')
|
form = EditCorpusFileForm(prefix='edit-corpus-file-form')
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
corpus_file.address = form.address.data
|
corpus_file.address = form.address.data
|
||||||
@ -292,9 +292,9 @@ def prepare_corpus(corpus_id):
|
|||||||
abort(403)
|
abort(403)
|
||||||
if corpus.files.all():
|
if corpus.files.all():
|
||||||
tasks.build_corpus(corpus_id)
|
tasks.build_corpus(corpus_id)
|
||||||
flash('Corpus "{}" has been marked to get build!', 'corpus')
|
flash('Corpus "{}" has been marked to get build!'.format(corpus.title), 'corpus') # noqa
|
||||||
else:
|
else:
|
||||||
flash('Can not build corpus "{}": No corpus file(s)!', 'error')
|
flash('Can not build corpus "{}": No corpus file(s)!'.format(corpus.title), 'error') # noqa
|
||||||
return redirect(url_for('.corpus', corpus_id=corpus_id))
|
return redirect(url_for('.corpus', corpus_id=corpus_id))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user