feat: add user permissions display in user_info page

This commit is contained in:
Baoshuo Ren 2022-10-01 18:55:50 +08:00
parent 092aacb74e
commit e0872fda48
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
3 changed files with 44 additions and 2 deletions

View File

@ -28,6 +28,11 @@
<div class="card"> <div class="card">
<img class="card-img-top" alt="Avatar of <?= $user['username'] ?>" src="<?= HTML::avatar_addr($user, 512) ?>" /> <img class="card-img-top" alt="Avatar of <?= $user['username'] ?>" src="<?= HTML::avatar_addr($user, 512) ?>" />
<div class="card-body"> <div class="card-body">
<?php if ($user['usergroup'] == 'S'): ?>
<span class="badge bg-secondary">
<?= UOJLocale::get('admin') ?>
</span>
<?php endif ?>
<h3> <h3>
<?= $user['username'] ?> <?= $user['username'] ?>
<span class="fs-6 align-middle" <span class="fs-6 align-middle"
@ -51,6 +56,29 @@
<?= $user['realname'] ?> <?= $user['realname'] ?>
</li> </li>
<?php endif ?> <?php endif ?>
<?php if ($user['usertype']): ?>
<li class="list-group-item">
<i class="bi bi-key-fill me-1"></i>
<?php foreach (explode(',', $user['usertype']) as $idx => $type): ?>
<?php if ($idx): ?>, <?php endif ?>
<?php if ($type == 'teacher'): ?>
<?= UOJLocale::get('teacher') ?>
<?php elseif ($type == 'student'): ?>
<?= UOJLocale::get('student') ?>
<?php elseif ($type == 'problem_uploader'): ?>
<?= UOJLocale::get('problem uploader') ?>
<?php elseif ($type == 'problem_manager'): ?>
<?= UOJLocale::get('problem manager') ?>
<?php elseif ($type == 'contest_judger'): ?>
<?= UOJLocale::get('contest judger') ?>
<?php elseif ($type == 'contest_only'): ?>
<?= UOJLocale::get('contest only') ?>
<?php else: ?>
<?= HTML::escape($type) ?>
<?php endif ?>
<?php endforeach ?>
</li>
<?php endif ?>
<li class="list-group-item"> <li class="list-group-item">
<i class="bi bi-envelope-fill me-1"></i> <i class="bi bi-envelope-fill me-1"></i>
<a class="text-decoration-none text-body" href="mailto:<?= HTML::escape($user['email']) ?>"> <a class="text-decoration-none text-body" href="mailto:<?= HTML::escape($user['email']) ?>">

View File

@ -86,5 +86,12 @@ return [
}, },
'friend links' => 'Frequently Used Links', 'friend links' => 'Frequently Used Links',
'server time' => 'Server Time', 'server time' => 'Server Time',
'opensource project' => 'OpenSource Project, modified by S2OJ' 'opensource project' => 'OpenSource Project, modified by S2OJ',
'admin' => 'Admin',
'student' => 'Student',
'teacher' => 'Teacher',
'problem uploader' => 'Problem Uploader',
'problem manager' => 'Problem Manager',
'contest judger' => 'Contest Judger',
'contest only' => 'Contest Only',
]; ];

View File

@ -86,5 +86,12 @@ return [
}, },
'friend links' => '常用链接', 'friend links' => '常用链接',
'server time' => '服务器时间', 'server time' => '服务器时间',
'opensource project' => '开源项目S2OJ 魔改版' 'opensource project' => '开源项目S2OJ 魔改版',
'admin' => '管理员',
'student' => '学生',
'teacher' => '老师',
'problem uploader' => '题目上传者',
'problem manager' => '题目管理者',
'contest judger' => '比赛评测员',
'contest only' => '仅比赛用户',
]; ];