<?php

namespace App\Controllers\Api;

class RbacApiController
{
public function check()
{

require_once
BASE_PATH .
'/app/helpers/permissions.php';

$url=
$_GET['url']
?? '';

$action=
$_GET['action']
?? 'view';

header(
'Content-Type: application/json'
);

echo json_encode([
'allowed'=>
function_exists('ec_can_action')
?
ec_can_action(
parse_url(
$url,
PHP_URL_PATH
),
$action
)
:
true
]);

exit;

}
}
