{% extends "base.html" %} {% load scoped_tags %} {% block title %}Rules{% endblock %} {% block page_title %}Rules{% endblock %} {% block page_subtitle %}Deny-overrides policy engine (Layer 5){% endblock %} {% block layer_indicator %}L5 Rules{% endblock %} {% block content %}
{{ rules|length }} rule{{ rules|length|pluralize }} defined
{# Invariant reminder #}

Deny always wins (Invariant 6)

When ALLOW and DENY rules conflict, DENY overrides. Rules are evaluated by priority (lower number = higher priority).

{% if rules %}
{% for rule in rules %} {% endfor %}
Name Type Effect Priority Bindings Conditions Created By Created
{{ rule.name }} {% if rule.description %}

{{ rule.description|truncatewords:10 }}

{% endif %}
{{ rule.rule_type }} {% if rule.effect == "ALLOW" %} ALLOW {% elif rule.effect == "DENY" %} DENY {% else %} {{ rule.effect }} {% endif %} {{ rule.priority }} {{ rule.binding_count }} {% if rule.bindings %}
{% for b in rule.bindings %} {{ b.target_type }}:{{ b.target_id|truncate_id }} {% endfor %}
{% endif %}
{% if rule.conditions %}
{{ rule.conditions|pretty_json }}
{% else %} None {% endif %}
{{ rule.created_by|truncate_id }} {{ rule.created_at|format_dt }}
{% else %} {% include "components/_empty_state.html" with title="No rules defined" message="Rules control access, rate limits, and feature flags. Create rules to enforce policies." %} {% endif %} {% endblock %}