diff --git a/inc/caldav-DELTICKET.php b/inc/caldav-DELTICKET.php new file mode 100644 index 00000000..4ac3fb02 --- /dev/null +++ b/inc/caldav-DELTICKET.php @@ -0,0 +1,45 @@ + +* @copyright Morphoss Ltd - http://www.morphoss.com/ +* @license http://gnu.org/copyleft/gpl.html GNU GPL v2 or later +*/ +dbg_error_log('DELTICKET', 'method handler'); +require_once('DAVResource.php'); + +if ( ! $request->HavePrivilegeTo('DAV::unbind') && $request->ticket->owner() != $session->principal_id ) { + $request->NeedPrivilege('DAV::unbind') +} + +if ( ! isset($request->ticket) ) { + if ( isset($_GET['ticket']) || isset($_SERVER['HTTP_TICKET']) ) { + $r = new DAVResource($request->path); + if ( ! $r->Exists() ) { + $request->PreconditionFailed(404,'not-found'); + } + else { + $request->PreconditionFailed(412,'ticket-does-not-exist','The specified ticket does not exist'); + } + } + else + $request->MalformedRequest('No ticket specified'); +} + +$qry = new AwlQuery('DELETE FROM access_ticket WHERE ticket_id=:ticket_id', array( ':ticket_id' => $request->ticket->id() ) ); +if ( $qry->Exec('DELTICKET', __LINE__, __FILE__) ) { + $request->DoResponse( 204 ); +} +$request->DoResponse( 500 );