{# Rights: the service rights and the grants, one line each to read, and their editor inside a form (see grants.py). Roles: as tags, and as checkboxes to give. #} {% macro grants_of(grants, names) %}{% for grant in grants %}{{ grant_summary(grant, names) }}{% else %}—{% endfor %}{% endmacro %} {% macro service_of(service) %}{% for right in service %}{{ right }} {% else %}—{% endfor %}{% endmacro %} {% macro rights_of(service, grants, names) %}{% if service %}
of the service {{ service_of(service) }}
{% endif %}{% if grants or not service %}{{ grants_of(grants, names) }}{% endif %}{% endmacro %} {% macro sending_of(sending) %}{% for limit in sending %}
{% if limit.recipients is none %}to anyone{% else %}to {{ limit.recipients | join(", ") }}{% endif %}, {% if limit.max_sends_per_day is none %}no daily limit{% else %}at most {{ limit.max_sends_per_day }} a day, {{ limit.sends_left }} left now{% endif %}
{% else %}—{% endfor %}{% endmacro %} {% macro role_tags(roles) %}{% for role in roles %}{{ role }} {% else %}—{% endfor %}{% endmacro %} {% macro role_checks(choices, held) %}
Roles
{% for role in choices %}{% endfor %}
{% endmacro %} {% macro grant_summary(grant, names) %}
on {% for account in grant.accounts %}{{ "every account" if account == "*" else names.get(account, account) }} {% endfor %} may {% for right in grant.allow %}{{ right }} {% endfor %} {% if grant.folders is not none %}in the folders {{ grant.folders | join(", ") }}{% endif %} {% if grant.recipients is not none %}sending to {{ grant.recipients | join(", ") }}{% endif %} {% if grant.max_sends_per_day is not none %}at most {{ grant.max_sends_per_day }} mails a day{% endif %} {% if grant.expires_at is not none %}{% if grant.expires_at | past %}expired on {{ grant.expires_at | when }}{% else %}until {{ grant.expires_at | when }}{% endif %}{% endif %}
{% endmacro %} {% macro service_editor(service, service_names, service_ops) %}
Rights of the service
{% for name in service_names %} {% endfor %}
Bound to no account: connecting accounts, users and roles, webhooks, the audit of administration. admin is every right.
Operation names of the service, beyond the groups.
{% endmacro %} {% macro grant_editor(rows, account_choices, groups, group_ops) %} {% for row in rows %} {% set i = loop.index0 %} {% set adding = loop.last %}
{{ "Add a grant" if adding else "Grant " ~ loop.index }}
Accounts
{% for id, email in account_choices %} {% endfor %}
Rights {% for caption, names in groups %} {{ caption }}
{% for group in names %} {% endfor %}
{% endfor %}
Operation names, beyond the groups.
From one account, in any 24 hours. Empty: no limit.
One per line: a role such as inbox, or a name. Subfolders count. Empty: every folder.
In the service's time zone. Empty: no end. Expired, the grant grants nothing.
One per line. Empty: to anyone.
{% if not adding %}{% endif %}
{% endfor %} {% endmacro %}