From e9b8b44d1bfe0c9848086bb2731f216b5870a787 Mon Sep 17 00:00:00 2001 From: Artem VV Date: Fri, 19 May 2023 21:15:27 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B0=D0=B7=D1=80=D0=B5=D1=88=D0=B8?= =?UTF-8?q?=D0=BB=20=D0=B2=D1=81=D0=B5=D0=BC=20=D0=BF=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8F=D0=BC=20=D1=81?= =?UTF-8?q?=D0=BC=D0=BE=D1=82=D1=80=D0=B5=D1=82=D1=8C=20=D1=81=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=BE=D0=BA=20=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D1=82=D0=B5=D0=BB=D0=B5=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Navbar.astro | 9 ++++----- src/pages/users.astro | 23 +++++++++++------------ 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/src/components/Navbar.astro b/src/components/Navbar.astro index 51b8acb..141cd38 100644 --- a/src/components/Navbar.astro +++ b/src/components/Navbar.astro @@ -14,13 +14,12 @@ const items = [ href: "/timetable", title: "Расписание", }, -]; -if (is_user_admin) { - items.push({ + { href: "/users", title: "Пользователи", - }); -} + }, +]; + const itemsRight = [ { href: "/logout", diff --git a/src/pages/users.astro b/src/pages/users.astro index 37573c6..f228077 100644 --- a/src/pages/users.astro +++ b/src/pages/users.astro @@ -17,9 +17,6 @@ if (Astro.cookies.has("session")) { const sessId = Astro.cookies.get("session").value!; const user = (await getSessionUser(sessId))!; -if (!user.is_admin) { - return Astro.redirect("/"); -} const sLogin = Astro.url.searchParams.get("login"); const sFullName = Astro.url.searchParams.get("fullName"); @@ -62,18 +59,20 @@ const users = await searchUsers({
{e.fullName}
{e.login}
- Открыть профиль - - Редактировать расписание - - + {user.is_admin ? ( + + + Редактировать расписание + + + ) : null}
))