{% extends "crashstats_base.html" %}

{% block page_title %}
Your Permissions
{% endblock %}

{% block site_css %}
{{ super() }}
<style>
.permissions th, .permissions td {
    padding: 4px 10px;;
}
</style>
{% endblock %}


{% block content %}
<div id="mainbody">
    <div class="page-heading">
        <h2>Your Permissions</h2>
    </div>

    <div class="panel">
        <div class="title">
            <h2>You are logged in as <b>{{ request.user.email }}</b>.</h2>
        </div>
        <div class="body">
        {% if request.user.is_superuser %}
          <p>
            You are a <b>superuser</b>. You have <b>unrestricted access to everything</b>.
          </p>
        {% else %}
        <table class="permissions">
            <thead>
                <tr>
                  <th>Permission</th>
                  <th>You</th>
                </tr>
            </thead>
            <tbody>
                {% for permission in permissions %}
                <tr>
                  <td>{{ permission.name }}</td>
                  <td>
                  {% if request.user.has_perm('crashstats.' + permission.codename) %}
                    Yes!
                  {% else %}
                    No
                  {% endif %}
                </tr>
                {% endfor %}
            </tbody>
        </table>
        {% endif %}
        </div>
    </div>
</div>
{% endblock %}
