aboutsummaryrefslogtreecommitdiff
path: root/vendor/edu-sharing-plugin/example/example-api.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/edu-sharing-plugin/example/example-api.php')
-rw-r--r--vendor/edu-sharing-plugin/example/example-api.php59
1 files changed, 0 insertions, 59 deletions
diff --git a/vendor/edu-sharing-plugin/example/example-api.php b/vendor/edu-sharing-plugin/example/example-api.php
deleted file mode 100644
index a961a7d..0000000
--- a/vendor/edu-sharing-plugin/example/example-api.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-define('APP_ID', 'data-quest Test');
-define('BASE_URL', 'http://localhost:8080/edu-sharing');
-define('USERNAME', 'root@studip');
-
-
-header('Accept: application/json');
-header('Content-Type: application/json');
-
-require_once "../edu-sharing-helper.php";
-require_once "../edu-sharing-helper-base.php";
-require_once "../edu-sharing-auth-helper.php";
-require_once "../edu-sharing-node-helper.php";
-
-$privatekey = @file_get_contents('private.key');
-if(!$privatekey) {
- die('no private key');
-} else {
- $key["privatekey"] = $privatekey;
-}
-// init the base class instance we use for all helpers
-$base = new EduSharingHelperBase(BASE_URL, $key["privatekey"], APP_ID);
-$postData = json_decode(file_get_contents('php://input'));
-$action = $postData->action;
-$result = null;
-if ($action === 'BASE_URL') {
- $result = BASE_URL;
-} else if ($action === 'GET_NODE') {
- $nodeHelper = new EduSharingNodeHelper($base);
- $result = $nodeHelper->getNodeByUsage(
- new Usage(
- $postData->nodeId,
- $postData->nodeVersion,
- $postData->containerId,
- $postData->resourceId,
- $postData->usageId
- )
- );
-} else if ($action === 'CREATE_USAGE') {
- $nodeHelper = new EduSharingNodeHelper($base);
- $result = $nodeHelper->createUsage(
- $postData->ticket,
- $postData->containerId,
- $postData->resourceId,
- $postData->nodeId
- );
-} else if ($action === 'DELETE_USAGE') {
- $nodeHelper = new EduSharingNodeHelper($base);
- $nodeHelper->deleteUsage(
- $postData->nodeId,
- $postData->usageId
- );
-} else if ($action === 'TICKET') {
- $authHelper = new EduSharingAuthHelper($base);
- $ticket = $authHelper->getTicketForUser(USERNAME);
- $result = $ticket;
-}
-
-echo json_encode($result);