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}
))