43 lines
1.3 KiB
PHP
43 lines
1.3 KiB
PHP
<?php
|
|
|
|
use api\classes\API_office_stompjes;
|
|
|
|
if (!$GLOBALS['modules_enabled']['office']) {
|
|
echo '405 Not Allowed';
|
|
exit;
|
|
}
|
|
|
|
session_start();
|
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/api/classes/API_office_stompjes.php';
|
|
|
|
$API_office_stompjes = new API_office_stompjes();
|
|
|
|
|
|
if ($API_office_stompjes->request_method === 'POST') {
|
|
$API_office_stompjes->checkPermissions('ofice-stompjes-canstomp', 'RW');
|
|
|
|
$API_office_stompjes->return_url = false;
|
|
|
|
$requiredFields = [
|
|
'user_uuid' => ['type' => 'uuid']
|
|
];
|
|
|
|
$API_office_stompjes->validateData($requiredFields);
|
|
|
|
$modules = $API_office_stompjes->addStomp();
|
|
|
|
$API_office_stompjes->apiOutput($code = 200, ['success' => 'stomp added successfully.']);
|
|
} elseif ($API_office_stompjes->request_method === 'DELETE') {
|
|
|
|
# Only superuser can delete permission due to fact that the backend needs programming when setting a permission
|
|
$API_office_stompjes->checkPermissions('ofice-stompjes', 'RW');
|
|
|
|
# when called from the frontend will not be forwarding to a url since when its called from the frontend it doesnt need a redirection
|
|
$API_office_stompjes->return_url = false;
|
|
|
|
$requiredFields = ['stomp_uuid' => ['type' => 'uuid']];
|
|
$API_office_stompjes->validateData($requiredFields);
|
|
|
|
# delete permission
|
|
$API_office_stompjes->deleteStomp();
|
|
} |