{#- Who may see and change a folder, for its managers: the community's members as on the folder above (inheritance), or only the people given a role here; those people, and those who have a role through the folder above; beside it, what changed. People see communities and people here, never groups. -#} {% extends "ads_community.html" %} {% import "documents/_dialogs.html" as dialogs with context %} {% set kw = {"community_id": g.community.slug, "folder_id": folder.id} %} {% set roles = {"reader": _("Reader"), "writer": _("Writer"), "manager": _("Manager")} %} {% block page_title %}{{ _("Permissions") }} · {{ folder.title }} · {{ g.community.name }}{% endblock %} {#- A table of people and their role on the folder, filtered and sorted on its own; with `controls`, each role may be taken back. -#} {% macro people(listing, rows, controls) %}
{{ icon("filter") }} {% for name, value in listing.filter_fields() %}{% endfor %} {{ ngettext("%(num)d person", "%(num)d people", listing.total) }}
{{ m.sort_th(listing, "name", _("Name")) }} {{ m.sort_th(listing, "role", _("Role")) }} {% if controls %}{% endif %} {% for user, role, has_access in rows %} {% if controls %} {% endif %} {% else %} {% endfor %}
{{ _("Actions") }}
{{ m.avatar(user, "ads-avatar--xs") }} {{ user.name }} {{ user.email }} {{ roles.get(role | string, role) }} {%- if not user.can_login %}{{ _("Disabled") }} {%- elif controls and not has_access %}{{ _("Cannot reach it") }}{% endif %}
{{ csrf.field() }}
{{ _("No matching records found") }}
{{ m.pagination(listing) }} {% endmacro %} {% block content %}
    {% for crumb in breadcrumbs %}
  1. {{ crumb.label }}
  2. {% endfor %}

{{ _("Who has access") }}

{{ icon("file-spreadsheet") }}{{ _("Export (spreadsheet)") }}
{{ csrf.field() }} {% if folder.inherit_security %} {{ _("The community's members, as on the folder above") }} {{ _("And the people given a role here.") }} {% else %} {{ _("Only the people given a role here") }} {{ _("The community's other members do not see it.") }} {% endif %}

{{ _("People given a role here") }}

{% if users_and_local_roles or local_listing.search %}{{ people(local_listing, users_and_local_roles, controls=True) }} {% else %}

{{ _("Nobody yet.") }}

{% endif %}
{% if folder.inherit_security %}

{{ _("Through the folder above") }}

{% if users_and_inherited_roles or inherited_listing.search %}{{ people(inherited_listing, users_and_inherited_roles, controls=False) }} {% else %}

{{ _("Nobody.") }}

{% endif %}
{% endif %}
{% endblock %} {% block overlays %} {% call dialogs.form_dialog("modal-add-user-local-role", _("Give someone a role on “%(name)s”", name=folder.title), _("Give the role"), url_for(".permissions_update", **kw), "add-user-role") %}
{{ _("A reader sees it; a writer also adds and changes; a manager also decides who has access.") }}
{% endcall %} {% endblock %}