diff options
| author | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
|---|---|---|
| committer | Philipp Schüttlöffel <schuettloeffel@zqs.uni-hannover.de> | 2024-09-24 10:53:31 +0200 |
| commit | 4459dd7917f4d1c34f40bb68f0e991e9c3d53e4c (patch) | |
| tree | 5c07151ae61276d334e88f6309c30d439a85c12e /vendor/edu-sharing-plugin/example/example-api.php | |
| parent | da0022e5c1abbf9825ae76debaabdff7e8623bb4 (diff) | |
| parent | 97a188592c679890a25c37ab78463add76a52ff7 (diff) | |
Merge branch 'main' into issue-3911issue-3911
Diffstat (limited to 'vendor/edu-sharing-plugin/example/example-api.php')
| -rw-r--r-- | vendor/edu-sharing-plugin/example/example-api.php | 59 |
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); |
