Merge pull request #505 from wrongecho/quick-fix-tech-financials

Role enforcement
This commit is contained in:
Johnny
2022-12-11 13:17:52 -05:00
committed by GitHub
2 changed files with 14 additions and 3 deletions

View File

@@ -320,7 +320,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
<?php } ?> <?php } ?>
<!-- Show actions for Admin role only --> <!-- Show actions for Admin role only -->
<?php //if($session_user_role == 3) { ?> <?php if ($session_user_role == 3) { ?>
<td> <td>
<div class="dropdown dropleft text-center"> <div class="dropdown dropleft text-center">
<button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown"> <button class="btn btn-secondary btn-sm" type="button" data-toggle="dropdown">
@@ -335,7 +335,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()"));
</div> </div>
</div> </div>
</td> </td>
<?php //} ?> <?php } ?>
</tr> </tr>
<?php <?php

View File

@@ -2,6 +2,17 @@
<?php <?php
// Quick fix to prevent non-admins (i.e. techs) seeing financials - redirect to client list
// To be removed when we have a proper technical dashboard for techs
if ($_SESSION['user_role'] != 3) { ?>
<script type="text/javascript">
window.location.href = 'clients.php';
</script>
<?php
exit();
}
function roundUpToNearestMultiple($n, $increment = 1000) function roundUpToNearestMultiple($n, $increment = 1000)
{ {
return (int) ($increment * ceil($n / $increment)); return (int) ($increment * ceil($n / $increment));