diff --git a/pillar/web/settings/routes.py b/pillar/web/settings/routes.py index 9623c79f..64c38282 100644 --- a/pillar/web/settings/routes.py +++ b/pillar/web/settings/routes.py @@ -35,3 +35,10 @@ def profile(): flash(message) return render_template('users/settings/profile.html', form=form, title='profile') + + +@blueprint.route('/roles') +@login_required +def roles(): + """Show roles and capabilties of the current user.""" + return render_template('users/settings/roles.html', title='roles') diff --git a/src/templates/users/settings/base.pug b/src/templates/users/settings/base.pug index 83bfd0c5..5b6ad086 100644 --- a/src/templates/users/settings/base.pug +++ b/src/templates/users/settings/base.pug @@ -17,6 +17,13 @@ i.pi-vcard | Profile | {% endblock settings_sidebar_menu %} + | {% block settings_sidebar_menu_bottom %} + a(class="{% if title == 'roles' %}active{% endif %}", + href="{{ url_for('settings.roles') }}") + li + i.pi-cog + | Roles & Capabilities + | {% endblock settings_sidebar_menu_bottom %} | {% endblock %} #settings-container diff --git a/src/templates/users/settings/roles.pug b/src/templates/users/settings/roles.pug new file mode 100644 index 00000000..61987128 --- /dev/null +++ b/src/templates/users/settings/roles.pug @@ -0,0 +1 @@ +| {% extends 'users/settings/roles_base.html' %} diff --git a/src/templates/users/settings/roles_base.pug b/src/templates/users/settings/roles_base.pug new file mode 100644 index 00000000..55dae84c --- /dev/null +++ b/src/templates/users/settings/roles_base.pug @@ -0,0 +1,35 @@ +| {% extends 'users/settings/page.html' %} +| {% block settings_page_title %}Roles & Capabilities{% endblock %} +| {% block settings_page_content %} +| {% block explanation %} +p. + Here is some behind-the-scenes info! In order to define what you can do on this website, we rely + on a system of #[em roles] and #[em capabilities]. For example, every website user "can-read" a + post, but only editors "can-write" and "can-edit" it. + +p. + Your roles are determined by multiple factors, such as being part of an organisation, being + subscribed to a service, etc… Your capabilities are determined by the roles you have. + +p. + If the website does not work as expected (for example you received permission-related errors), + it is often useful to mention what your Roles and Capabilities are when asking for support. +| {% endblock explanation %} + +dl.dl-horizontal + dt Your Roles + | {% for role in current_user.roles | sort %} + dd {{ role }} + | {% else %} + dd Your account has no roles assigned, which means you have a free account. + | {% endfor %} + +dl.dl-horizontal + dt Your Capabilities + | {% for cap in current_user.capabilities | sort %} + dd {{ cap }} + | {% else %} + dd Your account has no capabilities assigned. + | {% endfor %} + +| {% endblock %}