diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php index 95e124a1fcd5dad3c4d008c2b14340a3c7660eba..6acae0719f35404ed9b43e871a238b53d92c6a22 100644 --- a/include/ajax.tickets.php +++ b/include/ajax.tickets.php @@ -276,8 +276,17 @@ class TicketsAjaxAPI extends AjaxController { } function manageForms($ticket_id) { - $forms = DynamicFormEntry::forTicket($ticket_id); - $info = array('action' => '#tickets/'.Format::htmlchars($ticket_id).'/forms/manage'); + global $thisstaff; + + if (!$thisstaff) + Http::response(403, "Login required"); + elseif (!($ticket = Ticket::lookup($ticket_id))) + Http::response(404, "No such ticket"); + elseif (!$ticket->checkStaffPerm($thisstaff, Ticket::PERM_EDIT)) + Http::response(403, "Access Denied"); + + $forms = DynamicFormEntry::forTicket($ticket->getId()); + $info = array('action' => '#tickets/'.$ticket->getId().'/forms/manage'); include(STAFFINC_DIR . 'templates/form-manage.tmpl.php'); } @@ -288,7 +297,7 @@ class TicketsAjaxAPI extends AjaxController { Http::response(403, "Login required"); elseif (!($ticket = Ticket::lookup($ticket_id))) Http::response(404, "No such ticket"); - elseif (!$ticket->checkStaffPerm($thisstaff)) + elseif (!$ticket->checkStaffPerm($thisstaff, Ticket::PERM_EDIT)) Http::response(403, "Access Denied"); elseif (!isset($_POST['forms'])) Http::response(422, "Send updated forms list"); diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index 2b39913a5483cc892a0a0ce202e9b63b21fb6e96..782151d32172f9abd5245f0ee2db4513d2c7e7a3 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -168,11 +168,15 @@ if($ticket->isOverdue()) <?php } } ?> + <?php + if ($role->hasPerm(Ticket::PERM_EDIT)) { ?> <li><a href="#ajax.php/tickets/<?php echo $ticket->getId(); ?>/forms/manage" onclick="javascript: $.dialog($(this).attr('href').substr(1), 201); return false" ><i class="icon-paste"></i> <?php echo __('Manage Forms'); ?></a></li> + <?php + } ?> <?php if ($thisstaff->hasPerm(Email::PERM_BANLIST)) { if(!$emailBanned) {?>