Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions ckanext/open_alberta/authz.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import ckan.authz as authz
import ckan.lib.helpers as h

from pylons import config
import ckan.plugins.toolkit as toolkit

def is_authorized(action, context, data_dict=None):
if context.get('ignore_auth'):
Expand All @@ -27,18 +28,17 @@ def is_authorized(action, context, data_dict=None):
# access straight away
if not getattr(auth_function, 'auth_allow_anonymous_access', False) \
and not context.get('auth_user_obj'):
"""
return {'success': False,
if toolkit.asbool(config.get('ckan.open_alberta.login_before_everything', False)):
"""
Here we do not want to show not authorized. we want to
rediret to login url
"""
return h.redirect_to("/user/login?came_from={0}".format(h.full_current_url()))
else:
return {'success': False,
'msg': '{0} requires an authenticated user'
.format(auth_function)
}
"""
"""
Here we do not want to show not authorized. we want to
rediret to login url
"""
return h.redirect_to("/user/login?came_from={0}".format(h.full_current_url()))


return auth_function(context, data_dict)
else:
Expand Down
15 changes: 8 additions & 7 deletions ckanext/open_alberta/fanstatic/css/ab-opengov.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@
#alberta-ca.IDDP .logo a {
background: url(/img/AlbertaLogoWhiteV.svg) no-repeat center center;
background-size: 120px 51px; }
#alberta-ca.IDDP .page_primary_action {
margin-bottom: 15px; }
#alberta-ca.IDDP .search-giant .btn {
background: #555;
border-radius: 0;
border: 1px solid #555; }
#alberta-ca.IDDP #content {
background-color: #fff;
padding-top: 0; }
Expand Down Expand Up @@ -326,13 +332,8 @@
border-top: solid 1px #a0a0a0;
border-bottom: solid 1px #a0a0a0;
margin: 15px 0;
padding: 5px 0; }
#alberta-ca.IDDP .resources-order-by, #alberta-ca.IDDP .resources-page-size {
display: inline-block;
width: 48%; }
@media only screen and (max-width: 40em) {
#alberta-ca.IDDP .resources-order-by, #alberta-ca.IDDP .resources-page-size {
width: 100%; } }
padding: 15px 0;
font-size: 0.8em; }
#alberta-ca.IDDP .control-medium input, #alberta-ca.IDDP .control-medium textarea, #alberta-ca.IDDP .control-medium select {
min-width: 320px; }
#alberta-ca.IDDP .control-full input, #alberta-ca.IDDP .control-full textarea, #alberta-ca.IDDP .control-full select {
Expand Down
10 changes: 6 additions & 4 deletions ckanext/open_alberta/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,12 @@ def configure(self, config):

""" IAuthFunctions """
def get_auth_functions(self):
return {'package_list': package_authentication,
'package_show': package_authentication,
'package_search': package_authentication }

if toolkit.asbool(config.get('ckan.open_alberta.login_before_everything', False)):
return {'package_list': package_authentication,
'package_show': package_authentication,
'package_search': package_authentication }
else:
return {}
#IConfigurer
def update_config(self, config_):
toolkit.add_template_directory(config_, 'templates')
Expand Down
2 changes: 0 additions & 2 deletions ckanext/open_alberta/templates/package/base_form_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
{# Adminscreens sidebar #}
{% block secondary_content %}
{% block info_module %}

<section class="module module-narrow module-shallow">
<h2 class="module-heading"><i class="icon-info-sign"></i> {{ _(dataset_type|capitalize) }}</h2>
<div class="module-content">
Expand All @@ -20,7 +19,6 @@ <h2 class="module-heading"><i class="icon-info-sign"></i> {{ _(dataset_type|capi
</p>
</div>
</section>

{% endblock %}
{% endblock %}
{# Adminscreens sidebar #}
Expand Down
50 changes: 24 additions & 26 deletions ckanext/open_alberta/templates/package/edit.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
{% ckan_extends %}

{# Adminscreens sidebar #}
{% block secondary_content %}
{% block info_module %}

<section class="module module-narrow module-shallow">
<h2 class="module-heading"><i class="icon-info-sign"></i> {{ _(dataset_type|capitalize) }}</h2>
<div class="module-content">
<p>
{% if dataset_type == "publications" %}
{% trans %}
Information published by the government in a format meant for an end user/public.
{% endtrans %}
{% else %}
{% trans %}
GoA’s data whose release is not subject to privacy, security or legislative restrictions and which is made available to the public in a structured, machine-readable format with minimal restrictions on its use or re-use.
{% endtrans %}
{% endif %}
</p>
</div>
</section>

{% endblock %}
{% endblock %}
{# Adminscreens sidebar #}
{% ckan_extends %}

{# Adminscreens sidebar #}
{% block secondary_content %}
{% block info_module %}
<section class="module module-narrow module-shallow">
<h2 class="module-heading"><i class="icon-info-sign"></i> {{ _(dataset_type|capitalize) }}</h2>
<div class="module-content">
<p>
{% if dataset_type == "publications" %}
{% trans %}
Information published by the government in a format meant for an end user/public.
{% endtrans %}
{% else %}
{% trans %}
GoA’s data whose release is not subject to privacy, security or legislative restrictions and which is made available to the public in a structured, machine-readable format with minimal restrictions on its use or re-use.
{% endtrans %}
{% endif %}
</p>
</div>
</section>
{% endblock %}
{% endblock %}
{# Adminscreens sidebar #}
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@
</div>
{% endblock %}
</div>