point_system/point_system/students/templates/students/user_groups.html

83 lines
4.8 KiB
HTML

{% extends 'base.html' %}
{% block title %}Active Directory 群組成員資料 - 1218 Lab{% endblock %}
{% block content %}
<div class="row justify-content-center mt-4">
<div class="col-lg-10">
<div class="card shadow-sm border-0 rounded-3 mb-4">
<div class="card-header bg-primary text-white d-flex align-items-center justify-content-between py-3">
<h4 class="mb-0"><i class="fas fa-users-cog me-2"></i>Active Directory 群組 (Member Of)</h4>
<span class="badge bg-light text-primary fs-6">{{ groups|length }} 個群組</span>
</div>
<div class="card-body p-4">
<div class="row mb-4">
<div class="col-md-6">
<div class="p-3 bg-light rounded-3 border">
<h6 class="text-muted mb-2"><i class="fas fa-user me-2 text-primary"></i>目前登入使用者</h6>
<p class="h5 mb-1 text-dark fw-bold">{{ user.get_full_name|default:user.username }}</p>
<small class="text-muted">帳號: <code>{{ user.username }}</code> | Email: {{ user.email|default:"無" }}</small>
</div>
</div>
<div class="col-md-6 mt-3 mt-md-0">
<div class="p-3 bg-light rounded-3 border">
<h6 class="text-muted mb-2"><i class="fas fa-server me-2 text-primary"></i>Active Directory 伺服器資訊</h6>
<p class="h5 mb-1 text-dark fw-bold">{{ ad_server }}</p>
<small class="text-muted">網域 (Domain): <code>{{ ad_domain }}</code></small>
</div>
</div>
</div>
<h5 class="fw-bold text-secondary mb-3"><i class="fas fa-layer-group me-2"></i>所屬群組列表 (Groups User is a Member Of)</h5>
{% if groups %}
<div class="table-responsive">
<table class="table table-hover table-bordered align-middle">
<thead class="table-dark">
<tr>
<th scope="col" style="width: 5%;">#</th>
<th scope="col" style="width: 25%;">群組名稱 (Common Name)</th>
<th scope="col" style="width: 20%;">組織單位 (OU)</th>
<th scope="col" style="width: 50%;">完整辨識名 (Distinguished Name)</th>
</tr>
</thead>
<tbody>
{% for group in groups %}
<tr>
<td class="text-center text-muted fw-bold">{{ forloop.counter }}</td>
<td>
<span class="badge bg-primary fs-6 px-3 py-2">
<i class="fas fa-users me-1"></i> {{ group.cn }}
</span>
</td>
<td>
<small class="text-secondary fw-semibold">{{ group.ou_path }}</small>
</td>
<td>
<code class="text-break text-dark small bg-light p-1 rounded border d-block">{{ group.dn }}</code>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="alert alert-warning d-flex align-items-center rounded-3 p-4" role="alert">
<i class="fas fa-exclamation-triangle me-3 fs-2 text-warning"></i>
<div>
<h5 class="alert-heading mb-1">未找到群組資料或尚未從 Active Directory 取得群組</h5>
<p class="mb-0">此帳號目前沒有 direct memberOf 群組紀錄,或使用者非經由 Active Directory 登入。</p>
</div>
</div>
{% endif %}
</div>
<div class="card-footer bg-light py-3 d-flex justify-content-between align-items-center">
<a href="{% url 'index' %}" class="btn btn-outline-secondary btn-sm">
<i class="fas fa-arrow-left me-1"></i>返回首頁
</a>
<small class="text-muted">Domain Controller: <code>{{ ad_server }}</code></small>
</div>
</div>
</div>
</div>
{% endblock %}