Added Roles & Capabilities page to user settings

Thanks @fsiddi for helping with the explanatory text.
This commit is contained in:
Sybren A. Stüvel 2018-01-25 12:25:16 +01:00
parent 0a0c47205f
commit 6a17949fdf
4 changed files with 50 additions and 0 deletions

View File

@ -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')

View File

@ -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

View File

@ -0,0 +1 @@
| {% extends 'users/settings/roles_base.html' %}

View File

@ -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 %}