added trainees endpoint
This commit is contained in:
@@ -22,6 +22,27 @@ require_once("local/cwsvJudo.php");
|
||||
/// - since this is a rest api implementation we can assume each endpoint needs dbAccess
|
||||
require_once("participoLib/dbConnector.php");
|
||||
|
||||
function authorize()
|
||||
{
|
||||
if (array_key_exists("HTTP_AUTHORIZATION", $_SERVER)) {
|
||||
if (!empty($_SERVER["HTTP_AUTHORIZATION"])) {
|
||||
$auth = explode(" ", $_SERVER["HTTP_AUTHORIZATION"]);
|
||||
if ($auth[0] = "Basic") {
|
||||
$allowKey = ApiKey::loadFromDb($auth[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$allowKey || !$allowKey->isValidFor("api")) {
|
||||
die(
|
||||
json_encode([
|
||||
"success" => false,
|
||||
"reason" => "apiKey not sufficient or no api key provided",
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// - initialize the database connection
|
||||
dbConnector::connect(
|
||||
$cwsvJudoConfig["db"]["host"],
|
||||
|
||||
Reference in New Issue
Block a user