            <div class="card">
                <div class="card-header">
                    <div class="row">
                        <div class="col col-heading">
                            <div class="card-title">User permissions</div>
                        </div>
                    </div>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-12">
                            <p class="mb-4">Permissions are inherited from the groups the user belongs to. The table shows the effective permissions the user has on the platform.</p>
                            <table class="table table-striped table-bordered" id="user_audit_permissions_table">
                                <thead>
                                    <tr>
                                        <th>Permission</th>
                                        <th>Value</th>
                                        <th>Inherited from groups</th>
                                    </tr>
                                </thead>
                                <tbody>
                                {% for perm in permissions_audit['details'] %}
                                    <tr>
                                        <td>{{ permissions_audit['details'][perm].name }}</td>
                                        <td>0x{{ perm | int(perm,16) }}</td>
                                        <td>{% for group_id in permissions_audit['details'][perm].inherited_from  %}<span class="badge ml-2 badge-light">{{ permissions_audit['details'][perm].inherited_from[group_id].group_name }}</span>{% endfor %}</td>
                                    </tr>
                                {% endfor %}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
            <div class="card">
                <div class="card-header">
                    <div class="row">
                        <div class="col col-heading">
                            <div class="card-title">User cases access</div>
                        </div>
                    </div>
                </div>
                <div class="card-body">
                    <div class="row">
                        <div class="col-12">
                            <p>Click on a case to unveil access control path</p>
                            <table class="table table-striped table-bordered" id="user_audit_access_table">
                                <thead>
                                    <tr>
                                        <th>Case name</th>
                                        <th>Access</th>
                                    </tr>
                                </thead>
                                <tbody>
                                {% for case_id in access_audit %}
                                    <tr>
                                        <td>
                                        {% if access_audit[case_id].user_effective_access|length == 0 or 'deny_all' in access_audit[case_id].user_effective_access[0].name %}
                                            <i class="mr-2 fa-solid text-danger fa-eye-slash" title="No access"></i>
                                        {% elif 'read_only' in access_audit[case_id].user_effective_access[0].name %}
                                            <i class="mr-2 fa-solid text-warning fa-lock" title="Read only access"></i>
                                        {% else %}
                                            <i class="mr-2 fa-solid fa-circle-check text-success" title="Full access"></i>
                                        {% endif %}
                                            {{ access_audit[case_id].case_info.case_name }}
                                        </td>
                                        <td>{% if access_audit[case_id].user_effective_access|length == 0 %}
                                            <span class="badge badge-pill badge-light" title="Click to show trace"  href="#collapse_cac_{{case_id}}" style="cursor:pointer;" data-toggle="collapse" role="button" aria-expanded="false" aria-controls="collapse_cac_{{case_id}}">No access</span>
                                        {% else %}
                                            {% for uac in access_audit[case_id].user_effective_access %}
                                            <span class="badge badge-pill badge-light" title="Click to show trace"  href="#collapse_cac_{{case_id}}" style="cursor:pointer;" data-toggle="collapse" role="button" aria-expanded="false" aria-controls="collapse_cac_{{case_id}}">{{ uac.name }}</span>
                                            {% endfor %}
                                            <i class="fa-solid fa-eye ml-2" title="Click to show trace"  href="#collapse_cac_{{case_id}}" style="cursor:pointer;" data-toggle="collapse" role="button" aria-expanded="false" aria-controls="collapse_cac_{{case_id}}"></i>
                                        {% endif %}
                                            <ol class="activity-feed collapse" id="collapse_cac_{{case_id}}">
                                                {% if access_audit[case_id].user_effective_access|length == 0 %}
                                                    The user is neither in a group nor an organisation who has access to this case
                                                {% endif %}
                                                {% for uac in access_audit[case_id].user_access %}
                                                <li class="feed-item {% if uac.state == 'Effective' %} feed-item-success {% else %} feed-item-danger {% endif %}" title="{{ uac.state }}">
                                                    <span class="text">{% for ac in uac.access_list %}<span class="badge badge-pill badge-light">{{ ac.name }}</span>{% endfor %} ({{ uac.state }})</span><br />
                                                    <span class="text">Inherited from {{ uac.inherited_from.object_type }} <i class="fa-solid fa-right-long"></i> {{ uac.inherited_from.object_name }} (ID {{ uac.inherited_from.object_id }} :: UUID {{ uac.inherited_from.object_uuid }})</span>
                                                </li>
                                                {% endfor %}
                                            </ol>
                                        </td>
                                    </tr>
                                {% endfor %}
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
