{# Stale-role banner — shown on the unified /admin/permissions landing when the local capability matrix still holds rows for role slugs that are no longer active in Auth (deleted / deactivated / renamed upstream). Expected context: stale_role_slugs : list[str] — orphan slugs cleanup_url : str — POST target (e.g. /admin/permissions/cleanup-roles) csrf_token : str — request.cookies.get('csrftoken', '') from caller #}{% from "macros/i18n.html" import ch_t, ch_nt %} {% if stale_role_slugs %}
{{ ch_t("Orphan role rows detected") }}
{%- set _one = "The capability matrix still has rows for %(num)d role no longer active in Auth:" %}
{%- set _many = "The capability matrix still has rows for %(num)d roles no longer active in Auth:" %}
{%- if ch_i18n is defined and ch_i18n.translates(_one, _many) %}
{{ ch_nt("The capability matrix still has rows for %(num)d role no longer active in Auth:", "The capability matrix still has rows for %(num)d roles no longer active in Auth:", stale_role_slugs | length) }}
{% for slug in stale_role_slugs %}{{ slug }}{% if not loop.last %}, {% endif %}{% endfor %}.
{{ ch_t("Clean up to keep permission data consistent.") }}
{%- else %}
The capability matrix still has rows for
{{ stale_role_slugs | length }} role{{ 's' if stale_role_slugs | length != 1 else '' }}
no longer active in Auth:
{% for slug in stale_role_slugs %}{{ slug }}{% if not loop.last %}, {% endif %}{% endfor %}.
Clean up to keep permission data consistent.
{%- endif %}