ScoDoc/app/templates/auth/user_info_page.j2

124 lines
4.2 KiB
Plaintext
Raw Permalink Normal View History

2021-12-28 16:17:07 +01:00
{# -*- mode: jinja-html -*- #}
{% extends "base.j2" %}
2023-11-15 20:38:51 +01:00
{% import 'wtf.j2' as wtf %}
2021-10-17 11:19:01 +02:00
{% block app_content %}
<div class="user_info">
2021-10-17 11:19:01 +02:00
<h2>Utilisateur: {{user.user_name}} ({{'actif' if user.active else 'fermé'}})</h2>
<div class="user_basics">
2021-12-28 16:17:07 +01:00
<b>Login :</b> {{user.user_name}}<br>
2023-02-26 21:24:07 +01:00
<b>CAS id:</b> {{user.cas_id or "(aucun)"}}
2023-11-22 17:55:15 +01:00
{% if ScoDocSiteConfig.is_cas_enabled() %}
(CAS {{'autorisé' if user.cas_allow_login else 'interdit'}} pour cet utilisateur)
{% if user.cas_allow_scodoc_login %}
(connexion sans CAS autorisée)
{% endif %}
{% endif %}
2023-02-26 21:24:07 +01:00
<br>
2021-12-28 16:17:07 +01:00
<b>Nom :</b> {{user.nom or ""}}<br>
<b>Prénom :</b> {{user.prenom or ""}}<br>
{% if user.passwd_must_be_changed %}
<div style="color:white; background-color: red; padding:8px; margin-top: 4px; width: fit-content;">mot de passe à changer</div>
{% endif %}
2021-12-28 16:17:07 +01:00
<b>Mail :</b> {{user.email}}<br>
2023-03-14 16:30:27 +01:00
<b>Mail institutionnel:</b> {{user.email_institutionnel or ""}}<br>
2023-11-21 22:28:50 +01:00
<b>Identifiant EDT:</b> {{user.edt_id or ""}}<br>
<b>Rôles :</b> {{user.get_roles_string()}}<br>
<b>Dept :</b> {{user.dept or ""}}<br>
{% if user.passwd_temp or user.password_scodoc7 %}
<b class="fontred">⚠️ mot de passe invalide (compte ancien non migré à réactiver ou à fermer)</b><br>
{% endif %}
</div>
{% if current_user.is_administrator() %}
<div class="user_info_admin">
<b>Dernière vue :</b> {{user.last_seen.strftime(scu.DATEATIME_FMT) if user.last_seen else "-"}}<br>
<b>Dernière connexion CAS :</b> {{user.cas_last_login.strftime(scu.DATEATIME_FMT) if user.cas_last_login else "-"}}<br>
</div>
{% endif %}
<div class="user_basics">
2021-12-28 16:17:07 +01:00
<b>Dernière modif mot de passe:</b>
{{user.date_modif_passwd.strftime(scu.DATE_FMT) if user.date_modif_passwd else ""}}<br>
2021-12-28 16:17:07 +01:00
<b>Date d'expiration:</b>
{{user.date_expiration.strftime(scu.DATE_FMT) if user.date_expiration else "(sans limite)"}}
</div>
<div>
2021-10-17 11:19:01 +02:00
<ul>
2022-08-26 14:05:25 +02:00
{% if (
current_user.is_administrator()
or current_user.has_permission(Permission.UsersAdmin, user.dept)
2022-08-26 14:05:25 +02:00
) %}
2021-10-17 11:19:01 +02:00
<li><a class="stdlink" href="{{
2023-11-15 20:38:51 +01:00
url_for( 'users.form_change_password',
2021-10-17 11:19:01 +02:00
scodoc_dept=g.scodoc_dept, user_name=user.user_name)
}}">modifier le mot de passe ou l'adresse mail</a>
</li>
2022-08-26 14:05:25 +02:00
{% endif %}
{% if current_user.has_permission(Permission.UsersAdmin, dept) %}
2021-10-17 11:19:01 +02:00
<li><a class="stdlink" href="{{
2023-11-15 20:38:51 +01:00
url_for('users.create_user_form', scodoc_dept=g.scodoc_dept,
2021-10-17 11:19:01 +02:00
user_name=user.user_name, edit=1)
2022-08-26 14:05:25 +02:00
}}">modifier ce compte et ses rôles</a>
2021-12-28 16:17:07 +01:00
</li>
2021-10-17 11:19:01 +02:00
{% endif %}
2022-08-26 14:05:25 +02:00
{% if (
current_user.is_administrator()
or current_user.has_permission(Permission.UsersAdmin, user.dept)
2022-08-26 14:05:25 +02:00
) %}
<li><a class="stdlink" href="{{
2023-11-15 20:38:51 +01:00
url_for('users.toggle_active_user', scodoc_dept=g.scodoc_dept,
2022-08-26 14:05:25 +02:00
user_name=user.user_name)
}}">{{"désactiver" if user.active else "activer"}} ce compte</a>
</li>
2022-08-26 14:05:25 +02:00
{% endif %}
2021-10-17 11:19:01 +02:00
</ul>
</div>
2021-10-17 11:19:01 +02:00
{% if current_user.id == user.id %}
2023-02-26 21:24:07 +01:00
<div class="user_info_session">
{% if session_info %}
<p><b>CAS session started at </b>{{ session_info }}</p>
{% endif %}
<p><b>Se déconnecter:
<a class="stdlink" href="{{url_for('auth.logout')}}">logout</a>
</b>
</p>
{% if not (ScoDocSiteConfig.is_cas_enabled() and not user.cas_allow_scodoc_login) %}
<p><b>
<a class="stdlink" href="{{
url_for( 'users.form_change_password',
scodoc_dept=g.scodoc_dept, user_name=user.user_name)
}}">Changer votre mot de passe ScoDoc ou votre mail</a>
</b>
</p>
{% endif %}
2023-02-26 21:24:07 +01:00
</div>
2021-10-17 11:19:01 +02:00
{% endif %}
{# Liste des permissions #}
<div class="permissions">
2022-08-26 14:05:25 +02:00
<p><b>Permissions de cet utilisateur dans le département {{dept}}:</b></p>
2021-12-28 16:17:07 +01:00
<ul>
{% for p in Permission.description %}
<li>{{Permission.description[p]}} :
<b>{{
2021-12-28 16:17:07 +01:00
"oui" if user.has_permission(Permission.get_by_name(p), dept) else "non"
}}</b>
2021-12-28 16:17:07 +01:00
</li>
{% endfor %}
</ul>
2021-10-17 11:19:01 +02:00
</div>
{% if current_user.has_permission(Permission.UsersAdmin, dept) %}
2021-10-17 11:19:01 +02:00
<p><a class="stdlink" href="
{{url_for('users.index_html', scodoc_dept=g.scodoc_dept)}}
">Liste de tous les utilisateurs</a></p>
</div>
2021-10-17 11:19:01 +02:00
{% endif %}
2023-11-15 20:38:51 +01:00
{% endblock %}