示例#1
0
def journal_deactivate(journal_id):
    j = journal_handler.get_journal(journal_id)
    if j is None:
        abort(404)
    j.bibjson().active = False
    j.set_in_doaj(False)
    j.save()
    j.propagate_in_doaj_status_to_articles()  # will save each article, could take a while
    return redirect(url_for('.journal_page', journal_id=journal_id))
示例#2
0
def journal_page(journal_id):
    # user must have the role "edit_journal"
    if not current_user.has_role("edit_journal"):
        abort(401)

    # get the journal, so we can check our permissions against it
    j = journal_handler.get_journal(journal_id)

    # flag which we can set to determine whether this user can access the editorial
    # features of the journal form
    editorial_available = False

    # user must be either the "admin.editor" of the journal, or the editor of the "admin.editor_group"

    # is the user the currently assigned editor of the journal?
    passed = False
    if j.editor == current_user.id:
        passed = True

    # now check whether the user is the editor of the editor group
    # and simultaneously determine whether they have editorial rights
    # on this journal
    eg = models.EditorGroup.pull_by_key("name", j.editor_group)
    if eg is not None and eg.editor == current_user.id:
        passed = True
        editorial_available = True

    # if the user wasn't the editor or the owner of the editor group, unauthorised
    if not passed:
        abort(401)

    # create the list of allowable editors for this journal (the editor
    # and all the associates in this editor group)
    # egs = models.EditorGroup.groups_by_editor(current_user.id)
    editors = [current_user.id]
    editors += eg.associates
    editors = list(set(editors))

    return journal_handler.request_handler(
        request,
        journal_id,
        redirect_route="editor.journal_page",
        template="editor/journal.html",
        editors=editors,
        locked_template="editor/journal_locked.html",
        editorial_available=editorial_available)
示例#3
0
文件: editor.py 项目: jbarnsby/doaj
def journal_page(journal_id):
    # user must have the role "edit_journal"
    if not current_user.has_role("edit_journal"):
        abort(401)

    # get the journal, so we can check our permissions against it
    j = journal_handler.get_journal(journal_id)

    # flag which we can set to determine whether this user can access the editorial
    # features of the journal form
    editorial_available = False

    # user must be either the "admin.editor" of the journal, or the editor of the "admin.editor_group"

    # is the user the currently assigned editor of the journal?
    passed = False
    if j.editor == current_user.id:
        passed = True

    # now check whether the user is the editor of the editor group
    # and simultaneously determine whether they have editorial rights
    # on this journal
    eg = models.EditorGroup.pull_by_key("name", j.editor_group)
    if eg is not None and eg.editor == current_user.id:
        passed = True
        editorial_available = True

    # if the user wasn't the editor or the owner of the editor group, unauthorised
    if not passed:
        abort(401)

    # create the list of allowable editors for this journal (the editor
    # and all the associates in this editor group)
    # egs = models.EditorGroup.groups_by_editor(current_user.id)
    editors = [current_user.id]
    editors += eg.associates
    editors = list(set(editors))

    return journal_handler.request_handler(request, journal_id, redirect_route="editor.journal_page",
                                           template="editor/journal.html", editors=editors, locked_template="editor/journal_locked.html",
                                           editorial_available=editorial_available)