overview: view publications only if permission

This commit is contained in:
Christoph Ladurner
2024-05-07 10:10:38 +02:00
parent dac35b2e0e
commit 4a13f22de4
3 changed files with 10 additions and 0 deletions

View File

@@ -8,6 +8,8 @@
"""invenio module for TUGRAZ theme.""" """invenio module for TUGRAZ theme."""
from invenio_records_marc21.ui.theme import current_identity_can_view
from . import config from . import config
from .views import index, locked from .views import index, locked
@@ -29,6 +31,10 @@ class InvenioThemeTugraz(object):
app.register_error_handler(423, locked) 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 app.extensions["invenio-theme-tugraz"] = self
def init_config(self, app): def init_config(self, app):

View File

@@ -54,6 +54,7 @@
</div> </div>
</div> </div>
</div> </div>
{% if can_view_marc21 %}
<div class="column"> <div class="column">
<div class="ui segment" style="height: 480px"> <div class="ui segment" style="height: 480px">
<h2>{{ _("Publications") }}</h2> <h2>{{ _("Publications") }}</h2>
@@ -65,6 +66,7 @@
</div> </div>
</div> </div>
</div> </div>
{% endif %}
<div class="column"> <div class="column">
<div class="ui segment" style="height: 480px"> <div class="ui segment" style="height: 480px">
<h2>{{ _("Educational Resources") }}</h2> <h2>{{ _("Educational Resources") }}</h2>

View File

@@ -40,10 +40,12 @@ install_requires =
invenio-i18n>=1.3.1 invenio-i18n>=1.3.1
invenio_config_tugraz>=0.11.0 invenio_config_tugraz>=0.11.0
invenio_records_global_search>=0.0.1 invenio_records_global_search>=0.0.1
invenio_records_marc21>=0.21.0
[options.extras_require] [options.extras_require]
tests = tests =
invenio-app>=1.3.4,<1.4.0 invenio-app>=1.3.4,<1.4.0
invenio-previewer>=2.2.0
invenio-search[opensearch2]>=2.1.0,<3.0.0 invenio-search[opensearch2]>=2.1.0,<3.0.0
pytest-black-ng>=0.4.0 pytest-black-ng>=0.4.0
pytest-invenio>=2.1.0,<3.0.0 pytest-invenio>=2.1.0,<3.0.0