Skip to content

Commit

Permalink
PUSH
Browse files Browse the repository at this point in the history
-> Done #80
  • Loading branch information
NaysKutzu committed Oct 25, 2023
1 parent 9b2c8fd commit 511ea68
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 10 deletions.
1 change: 1 addition & 0 deletions migrate/22.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE `mythicaldash_users` CHANGE `role` `role` ENUM('Administrator','Support','User') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'User';
8 changes: 7 additions & 1 deletion view/admin/tickets/list.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
<?php
use MythicalDash\SettingsManager;
include(__DIR__ . '/../../requirements/page.php');
include(__DIR__ . '/../../requirements/admin.php');
if ($session->getUserInfo("role") == "Administrator" || $session->getUserInfo("role") == "Support") {

} else {
header('location: /e/401');
die();
}


$ticketsPerPage = 20;
$page = isset($_GET['page']) && is_numeric($_GET['page']) ? (int) $_GET['page'] : 1;
Expand Down
5 changes: 4 additions & 1 deletion view/components/navbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ class="dropdown-item d-flex justify-content-center text-primary p-2 h-px-40 mb-1
<?= $session->getUserInfo("username") ?>
<span class="badge bg-<?php if ($session->getUserInfo("role") == "Administrator") {
echo 'danger';
} else {
} else if ($session->getUserInfo("role") == "Support") {
echo "warning";
}
else {
echo 'success';
} ?> requestor-type ms-2">
<?= $session->getUserInfo("role") ?>
Expand Down
29 changes: 22 additions & 7 deletions view/components/sidebar.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
use MythicalDash\SettingsManager;

function is_active_page($page_urls)
{
foreach ($page_urls as $page_url) {
Expand Down Expand Up @@ -123,19 +124,18 @@ function is_active_page($page_urls)
<span class="menu-header-text">Administration Tools</span>
</li>
<li class="menu-item <?php echo is_active_page(['/admin/overview']) ? 'active' : ''; ?>">
<a href="/admin/overview" class="menu-link">
<i class="menu-icon tf-icons ti ti-home"></i>
<div>Overview</div>
</a>
</li>
<a href="/admin/overview" class="menu-link">
<i class="menu-icon tf-icons ti ti-home"></i>
<div>Overview</div>
</a>
</li>
<li class="menu-item <?php echo is_active_page(['/admin/api']) ? 'active' : ''; ?>">
<a href="/admin/api" class="menu-link">
<i class="menu-icon tf-icons ti ti-device-gamepad-2"></i>
<div>Application API</div>
</a>
</li>
<li
class="menu-item <?php echo is_active_page(['/admin/servers', '/admin/server/delete']) ? 'active' : ''; ?>">
<li class="menu-item <?php echo is_active_page(['/admin/servers', '/admin/server/delete']) ? 'active' : ''; ?>">
<a href="/admin/servers" class="menu-link">
<i class="menu-icon tf-icons ti ti-server"></i>
<div>Servers</div>
Expand Down Expand Up @@ -181,5 +181,20 @@ class="menu-item <?php echo is_active_page(['/admin/users', '/admin/users/edit',
<?php
}
?>
<?php
if ($session->getUserInfo("role") == "Support") {
?>
<li class="menu-header small text-uppercase">
<span class="menu-header-text">Support Tools</span>
</li>
<li class="menu-item <?php echo is_active_page(['/admin/tickets']) ? 'active' : ''; ?>">
<a href="/admin/tickets" class="menu-link">
<i class="menu-icon tf-icons ti ti-messages"></i>
<div>Tickets</div>
</a>
</li>
<?php
}
?>
</ul>
</aside>
5 changes: 4 additions & 1 deletion view/requirements/admin.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<?php
if ($session->getUserInfo("role") == "User") {
if ($session->getUserInfo("role") == "Administrator") {

} else {
header('location: /e/401');
die();
}
?>

0 comments on commit 511ea68

Please sign in to comment.