Skip to content

Commit

Permalink
Merge pull request #7 from SmdhMdep/Fix-Protected-when-logged-in
Browse files Browse the repository at this point in the history
Fix protected when logged in
  • Loading branch information
D-Simona-G authored Mar 22, 2023
2 parents 8c48e9c + 03d4092 commit e8e1f1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions ckanext/generalpublic/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,13 @@ def is_public(packageid):

data = {'packageid': packageid}

#TODO: get list of all visibilies that have Ckanmapping false and make them return a false

visibility = tk.get_action('get_package_visibility')({'ignore_auth': True}, data)

try:
if visibility.visibility == "Protected":
return False
else:
if visibility.visibility == "Public":
return True
else:
return False
except:
return True
return False

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% ckan_extends %}

{% block resource_item_explore_links %}
{%if h.is_public(pkg.id) %}
{%if h.is_public(pkg.id) or c.userobj%}
<li>
<a href="{{ url }}">
{% if not is_activity_archive and res.has_views %}
Expand Down Expand Up @@ -36,7 +36,7 @@
{% endif %}
{% else %}
<li>
<a href="https://smdh.uk/#register">
<a href="https://mdep.smdh.uk/user/saml2login">
<i class="fa fa-info-circle"></i>
{{ _('Get Access to this data') }}
</a>
Expand Down

0 comments on commit e8e1f1e

Please sign in to comment.