use roles guards

This commit is contained in:
Thanakorn S
2026-05-22 08:45:35 +07:00
parent f2b87cfd0f
commit cf25732da0
19 changed files with 133 additions and 66 deletions
+14 -19
View File
@@ -1,7 +1,6 @@
<?php
$current_page = basename($_SERVER['PHP_SELF']);
$setting_role = $_SESSION['login_role'] ?? 'viewer';
$setting_can_admin = in_array($setting_role, ['owner', 'admin'], true);
?>
<!-- SIDEBAR -->
@@ -38,15 +37,13 @@
</a>
</li>
<?php if ($setting_can_admin): ?>
<li>
<a class="nav-link <?php echo $current_page === 'users.php' ? 'active' : ''; ?>"
href="<?php echo $server_url?>setting/users.php">
<i class="ti ti-users"></i>
<span class="nav-text">Users Access</span>
</a>
</li>
<?php endif; ?>
<li>
<a class="nav-link <?php echo $current_page === 'users.php' ? 'active' : ''; ?>"
href="<?php echo $server_url?>setting/users.php">
<i class="ti ti-users"></i>
<span class="nav-text">Users Access</span>
</a>
</li>
<li>
<a class="nav-link <?php echo $current_page === 'smtp.php' ? 'active' : ''; ?>"
@@ -56,15 +53,13 @@
</a>
</li>
<?php if ($setting_can_admin): ?>
<li>
<a class="nav-link <?php echo $current_page === 'system_config.php' ? 'active' : ''; ?>"
href="<?php echo $server_url?>setting/system_config.php">
<i class="ti ti-adjustments-cog"></i>
<span class="nav-text">System Configuration</span>
</a>
</li>
<?php endif; ?>
<li>
<a class="nav-link <?php echo $current_page === 'system_config.php' ? 'active' : ''; ?>"
href="<?php echo $server_url?>setting/system_config.php">
<i class="ti ti-adjustments-cog"></i>
<span class="nav-text">System Configuration</span>
</a>
</li>
<!-- Back -->
<li class="nav-text-space mt-2">