35 lines
959 B
PHP
35 lines
959 B
PHP
<?php
|
|
/** @var array $CONFIG basic configurations (defined via bootstraping) */
|
|
/** @var array $SECRETS passwords and other stuff worth of protection (defined via bootstraping) */
|
|
require_once "bootstrap.php";
|
|
|
|
require_once "config/participo.php";
|
|
|
|
require_once "./local/cwsvJudo.php";
|
|
|
|
require_once "participoLib/participo.php";
|
|
require_once "participoLib/apiKey.php";
|
|
|
|
require_once "spyc/Spyc.php";
|
|
|
|
participo::init($CONFIG["cwsvJudo"], $SECRETS["cwsvJudo"]);
|
|
|
|
$userId = 1;
|
|
$apiKey = ApiKey::create();
|
|
// $rightString = 'event:' . PHP_EOL . ' id: 1';
|
|
// $rightArray = Spyc::YAMLLoadString($rightString);
|
|
$right = "login";
|
|
$date = new DateTime();
|
|
$newKey = new ApiKey(null, $userId, $apiKey, $right, $date->format("Y-m-d"));
|
|
$newKey->addToDb();
|
|
$loadedKey = ApiKey::loadFromDb($apiKey);
|
|
?>
|
|
<!doctype html>
|
|
<html>
|
|
<body>
|
|
<ul>
|
|
<li>rightsRoundabout: <?echo( $loadedKey->isValidFor($right) ? 'TRUE' : 'FALSE' );?></li>
|
|
</ul>
|
|
</body>
|
|
<html>
|