diff --git a/ckanext/portalopendatadk/controller.py b/ckanext/portalopendatadk/controller.py index 2389b08..5a2e48a 100644 --- a/ckanext/portalopendatadk/controller.py +++ b/ckanext/portalopendatadk/controller.py @@ -35,6 +35,8 @@ def __before__(self, action, **env): # else redirect to the home page if not user_has_admin_access(False) and action != 'request_reset': h.redirect_to(controller='home', action='index') + if not authz.is_sysadmin(c.user) and action == 'register': + h.redirect_to(controller='home', action='index') def new(self, data=None, errors=None, error_summary=None): '''GET to display a form for registering a new user. diff --git a/ckanext/portalopendatadk/templates/organization/member_new.html b/ckanext/portalopendatadk/templates/organization/member_new.html new file mode 100644 index 0000000..c6a8d48 --- /dev/null +++ b/ckanext/portalopendatadk/templates/organization/member_new.html @@ -0,0 +1,90 @@ +{% extends "organization/edit_base.html" %} + +{% import 'macros/form.html' as form %} + +{% set user = c.user_dict %} + +{% block subtitle %}{{ _('Edit Member') if user else _('Add Member') }} - {{ super() }}{% endblock %} + +{% block primary_content_inner %} + {% link_for _('Back to all members'), controller='organization', action='members', id=organization.name, class_='btn pull-right', icon='arrow-left' %} +

+ {% block page_heading %}{{ _('Edit Member') if user else _('Add Member') }}{% endblock %} +

+ {% block form %} +
+
+
+ {% if not user %} + + + {{ _('If you wish to add an existing user, search for their username below.') }} + + {% endif %} +
+ {% if user %} + + + {% else %} + + {% endif %} +
+
+ {% if c.userobj.sysadmin %} +
+ {{ _('or') }} +
+
+ + + {{ _('If you wish to invite a new user, enter their email address.') }} + +
+ +
+
+ {% endif %} +
+ {% set format_attrs = {'data-module': 'autocomplete'} %} + {{ form.select('role', label=_('Role'), options=c.roles, selected=c.user_role, error='', attrs=format_attrs) }} +
+ {% if user %} + {{ _('Delete') }} + + {% else %} + + {% endif %} +
+
+ {% endblock %} +{% endblock %} + +{% block secondary_content %} +{{ super() }} +
+

+ + {{ _('What are roles?') }} +

+
+ {% trans %} +

Admin: Can add/edit and delete datasets, as well as + manage organization members.

+

Editor: Can add and edit datasets, but not manage + organization members.

+

Member: Can view the organization's private + datasets, but not add new datasets.

+ {% endtrans %} +
+{% endblock %} \ No newline at end of file diff --git a/ckanext/portalopendatadk/templates/user/dashboard.html b/ckanext/portalopendatadk/templates/user/dashboard.html index 98c45bf..f4a2b38 100644 --- a/ckanext/portalopendatadk/templates/user/dashboard.html +++ b/ckanext/portalopendatadk/templates/user/dashboard.html @@ -13,7 +13,7 @@ {% block page_header %}