Browse Source

wrote a quick permission query example

dev
Cerys 4 weeks ago
parent
commit
3bc1e6c7fe
  1. 19
      examples/DeegraphConnection.php
  2. 20
      examples/QueryExample_Permission.php

19
examples/DeegraphConnection.php

@ -0,0 +1,19 @@
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use Darksparrow\DeegraphInteractions\Core\DeegraphServer;
class DeegraphConnection
{
public static function DB(): DeegraphServer
{
return new DeegraphServer(
token: "",
actor: "",
server: "localhost",
port: 8880,
allowSelfSignedCerts: false,
);
}
}

20
examples/QueryExample_Permission.php

@ -0,0 +1,20 @@
<?php
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../examples/DeegraphConnection.php';
use Darksparrow\DeegraphInteractions\QueryBuilder\QueryBuilder;
$permissions = QueryBuilder::Permission()
->On("b222c121-0ed2-5819-bbf9-4db9aab85ea3")
->Build()
->RunQuery(DeegraphConnection::DB())
;
echo "Permissions\n";
echo "===========";
echo "\nCan Act: " . ($permissions->CanAct ? "YES" : "NO");
echo "\nCan Delete: " . ($permissions->CanDelete ? "YES" : "NO");
echo "\nCan Read: " . ($permissions->CanRead ? "YES" : "NO");
echo "\nCan Write: " . ($permissions->CanWrite ? "YES" : "NO");
Loading…
Cancel
Save