|
|
|
<?php
|
|
|
|
|
|
|
|
// https://github.com/owoalex/deegraph/blob/main/docs/query-grant.md#examples
|
|
|
|
|
|
|
|
global $db;
|
|
|
|
require_once __DIR__ . '/../vendor/autoload.php';
|
|
|
|
require_once __DIR__ . '/../examples/connection.php';
|
|
|
|
|
|
|
|
use Darksparrow\DeegraphInteractions\Enumerators\DeegraphPermissionType;
|
|
|
|
use Darksparrow\DeegraphInteractions\QueryBuilder\QueryBuilder;
|
|
|
|
use Darksparrow\DeegraphInteractions\QueryInstance\GrantQuery;
|
|
|
|
|
|
|
|
function Example0(): GrantQuery
|
|
|
|
{
|
|
|
|
$queryBuilder = QueryBuilder::Grant()
|
|
|
|
->Permissions(permissionTypes: [
|
|
|
|
DeegraphPermissionType::WRITE,
|
|
|
|
DeegraphPermissionType::READ,
|
|
|
|
])
|
|
|
|
->On(target: "*")
|
|
|
|
->IsDelegatable();
|
|
|
|
|
|
|
|
return $queryBuilder->Build();
|
|
|
|
}
|
|
|
|
function Example1(): GrantQuery
|
|
|
|
{
|
|
|
|
$queryBuilder = QueryBuilder::Grant()
|
|
|
|
->Permissions(permissionTypes: [
|
|
|
|
DeegraphPermissionType::WRITE,
|
|
|
|
DeegraphPermissionType::READ,
|
|
|
|
])
|
|
|
|
->On(target: "*")
|
|
|
|
->IsDelegatable();
|
|
|
|
|
|
|
|
return $queryBuilder->Build();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$result = Example0()->RunQuery($db);
|
|
|
|
var_dump($result);
|