adding docu, some cleanup

This commit is contained in:
marko
2023-04-02 17:08:16 +02:00
parent 92f8ff4a24
commit a906c924b3
3 changed files with 69 additions and 20 deletions

View File

@@ -17,10 +17,11 @@ dbConnector::connect(
$userId = 1;
$apiKey = ApiKey::create();
$rightString = 'event:' . PHP_EOL . ' id: 1';
$rightArray = Spyc::YAMLLoadString($rightString);
// $rightString = 'event:' . PHP_EOL . ' id: 1';
// $rightArray = Spyc::YAMLLoadString($rightString);
$right = 'login';
$date = new DateTime();
$newKey = new ApiKey(null, $userId, $apiKey, $rightString, $date->format('Y-m-d'));
$newKey = new ApiKey(null, $userId, $apiKey, $right, $date->format('Y-m-d'));
$newKey->addToDb();
$loadedKey = ApiKey::loadFromDb($apiKey);
@@ -29,7 +30,7 @@ $loadedKey = ApiKey::loadFromDb($apiKey);
<html>
<body>
<ul>
<li>rightsRoundabout: <?echo( $loadedKey->isValidFor($rightArray) ? 'TRUE' : 'FALSE' );?></li>
<li>rightsRoundabout: <?echo( $loadedKey->isValidFor($right) ? 'TRUE' : 'FALSE' );?></li>
</ul>
</body>
<html>