Work on login
This commit is contained in:
+7
-3
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
|
||||
function hasPermission(string $resourceName, string $actionName): bool
|
||||
function hasPermission(string $resourceName, string $actionName)
|
||||
{
|
||||
global $conn;
|
||||
|
||||
if(!isset($_SESSION['id'])){
|
||||
return false;
|
||||
http_response_code(401);
|
||||
exit;
|
||||
}
|
||||
|
||||
$sql = "
|
||||
@@ -28,5 +29,8 @@ function hasPermission(string $resourceName, string $actionName): bool
|
||||
|
||||
$result = $stmt->fetch();
|
||||
|
||||
return ((int) $result['permission_count']) > 0;
|
||||
if(((int) $result['permission_count']) <= 0){
|
||||
http_response_code(403);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user