fix related package auth
--- a/ckanext/datagovau/plugin.py
+++ b/ckanext/datagovau/plugin.py
@@ -24,7 +24,7 @@
def get_related_dataset(related_id):
result = model.Session.execute("select dataset_id from related_dataset where related_id =\'"+related_id+"\' limit 1;").first()[0]
- return lib.helpers.get_action('package_show',{'id':result})
+ return result
def related_create(context, data_dict=None):
return {'success': False, 'msg': 'No one is allowed to create related items'}
--- a/ckanext/datagovau/templates/related/snippets/related_item.html
+++ b/ckanext/datagovau/templates/related/snippets/related_item.html
@@ -22,8 +22,8 @@
{{ h.render_markdown(related.description) }}
</div>
{% endif %}
- {% if h.get_related_dataset(related.id) %}
-<small>Using dataset: {{ h.get_related_dataset(related.id).title }}</small>
+ {% if h.check_access('package_show',{"id":h.get_related_dataset(related.id)}) %}
+<small>Using dataset: {{ h.get_action('package_show',{"id":h.get_related_dataset(related.id)}).title }}</small>
{% endif %}
<a class="media-view" href="{{ related.url }}" target="_blank" title="{{ tooltip }}">