Skip to content

Commit

Permalink
overview: view publications only if permission
Browse files Browse the repository at this point in the history
  • Loading branch information
utnapischtim committed May 7, 2024
1 parent dac35b2 commit 4a13f22
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions invenio_theme_tugraz/ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

"""invenio module for TUGRAZ theme."""

from invenio_records_marc21.ui.theme import current_identity_can_view

from . import config
from .views import index, locked

Expand All @@ -29,6 +31,10 @@ def init_app(self, app):

app.register_error_handler(423, locked)

@app.context_processor
def inject_visibility():
return {"can_view_marc21": current_identity_can_view()}

app.extensions["invenio-theme-tugraz"] = self

def init_config(self, app):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ <h2>{{ _("Requests") }}</h2>
</div>
</div>
</div>
{% if can_view_marc21 %}
<div class="column">
<div class="ui segment" style="height: 480px">
<h2>{{ _("Publications") }}</h2>
Expand All @@ -65,6 +66,7 @@ <h2>{{ _("Publications") }}</h2>
</div>
</div>
</div>
{% endif %}
<div class="column">
<div class="ui segment" style="height: 480px">
<h2>{{ _("Educational Resources") }}</h2>
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ install_requires =
invenio-i18n>=1.3.1
invenio_config_tugraz>=0.11.0
invenio_records_global_search>=0.0.1
invenio_records_marc21>=0.21.0

[options.extras_require]
tests =
invenio-app>=1.3.4,<1.4.0
invenio-previewer>=2.2.0
invenio-search[opensearch2]>=2.1.0,<3.0.0
pytest-black-ng>=0.4.0
pytest-invenio>=2.1.0,<3.0.0
Expand Down

0 comments on commit 4a13f22

Please sign in to comment.