You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
<?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()
|
|
|
|
->GrantAll()
|
|
|
|
->On(target: "*")
|
|
|
|
->IsDelegatable();
|
|
|
|
|
|
|
|
return $queryBuilder->Build();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$result = Example0()->RunQuery($db);
|
|
|
|
var_dump($result);
|