diff --git a/include/class.staff.php b/include/class.staff.php index 6725a9c85ba105c4f619ac72f86af9e39ad6ee48..f386f1051c004edaa731da65d1783d261ebd2b30 100644 --- a/include/class.staff.php +++ b/include/class.staff.php @@ -410,6 +410,9 @@ implements AuthenticatedUser, EmailContact, TemplateVariable { if ($access = $this->dept_access->findFirst(array('dept_id' => $deptId))) return $this->_roles[$deptId] = $access->role; + + // View only access + return new Role(array()); } // For the primary department, use the primary role return $this->role; diff --git a/include/class.ticket.php b/include/class.ticket.php index f0e7936558c91151ca37d00b015492efbe0af2f2..8cc9546b8d89e35788c2aa0fc3ddaf7e0f97283a 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -3248,8 +3248,12 @@ implements RestrictedAccess, Threadable { static function open($vars, &$errors) { global $thisstaff, $cfg; - if (!$thisstaff || !$thisstaff->hasPerm(TicketModel::PERM_CREATE)) + if ($vars['deptId'] && $thisstaff && !$thisstaff->getRole($vars['deptId']) + ->hasPerm(TicketModel::PERM_CREATE) + ) { + $errors['err'] = __('You do not have permission to create a ticket in this department'); return false; + } if ($vars['source'] && !in_array( strtolower($vars['source']), array('email','phone','other')) diff --git a/include/staff/ticket-open.inc.php b/include/staff/ticket-open.inc.php index 6e2f9bae14106e8077ff70b189ea9f3bacdb7472..0220009eb59b748b710255b6536ef7d87dd50293 100644 --- a/include/staff/ticket-open.inc.php +++ b/include/staff/ticket-open.inc.php @@ -181,8 +181,14 @@ if ($_POST) <select name="deptId"> <option value="" selected >— <?php echo __('Select Department'); ?>—</option> <?php - if($depts=Dept::getDepartments()) { + if($depts=Dept::getDepartments(array('dept_id' => $thisstaff->getDepts()))) { foreach($depts as $id =>$name) { + if (!($role = $thisstaff->getRole($id)) + || !$role->hasPerm(Ticket::PERM_CREATE) + ) { + // No access to create tickets in this dept + continue; + } echo sprintf('<option value="%d" %s>%s</option>', $id, ($info['deptId']==$id)?'selected="selected"':'',$name); } diff --git a/scp/css/scp.css b/scp/css/scp.css index 89e880e0db8dde3d0ea065a16ed885cd2d6a79bb..73cb08bfa48408c2d598d5558005cb95fba1188f 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -1817,6 +1817,9 @@ select + .button { .input.attached input { height: 100%; box-sizing: border-box; + margin-right:0; + border: 1px solid #999; + border-right:none; } .input.attached .button.attached { height: 100%;