Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Restricting New Ticket "Deptartment" and "Assigned To" by User Group?

Hi I'm new to the forums and to osTicket so I'll give a little background. I'm a graphic designer and programmer and I've recently quit my day job to work for myself. My mind is generally very cluttered and I need a ticketing system so I can keep up with all of my projects and clients. By the way, this is a slick little system well done!

How I use osTicket
I make a new Department for each project I'm working on and create a user group matching that department name. I add Staff accounts for people involved in each project and put them into their respective User Group, which is set to only allow access to it's corresponding Department.

What I'm Looking To Do
It works as expected for hiding open department-based tickets from other groups but when a Staff user creates a new ticket, all departments and users show up in the "Department" and "Assign To" fields respectively, regardless of User Group the current (Staff-level) user is in.

Ideally I would like to be able to restrict both fields to only those Departments and Staff associated with the current user's Group. Since this is more like my personal project list, allowing new tickets and discussion with clients and others involved in each project, I don't need those involved in one project even knowing about my other projects and categorizations of tasks.

Can anyone offer some insight? Did any of that even makes sense? :D


  • (feels like i should have made this in the Features Request - sorry mod!)
  • Any luck?

    Hi... have you found any help for this?

    I need something similar ... !:)
  • New Ticket by staff restrict department & assigned to drop down box

    I have searched the forum for information about restricting the drop down options for staff members (for "Department" & "Assign To"). I would like to have staff members create new tickets (from the 'back-end) but when creating a new ticket it should only show them the departments they are assigned to and they should be able to only assign other staff members from those departments, not showing all staff members).

    This maybe a little bit different than the 'regular' use but this would be useful.

    Any suggestions/changes are really welcome. Thanks.
  • I haven't tested this code yet because it's Saturday but this should get you on the right track...

    In the file include/staff/ replace the following select item starting at line 58

     <select name=\"deptId\">
    <option value=\"\" selected >Select Department</option>
    $services= db_query('SELECT dept_id,dept_name FROM '.DEPT_TABLE.' ORDER BY dept_name');
    while (list($deptId,$dept) = db_fetch_row($services)){
    if($info['deptId'] == canAccessDept($info['deptId'])){
    $selected = ($info['deptId']==$deptId)?'selected':''; ?>
    <option value=\"<?=$deptId?>\"<?=$selected?>><?=$dept?></option>
    } }?>

    I have added a query that will return if the staff member can access the department, if the query returns false the staff member shouldn't be able to access it.
    The reason I put it in place like this is to ensure it doesn't affect people with access to multiple departments.

    This is off the top of my head and if it doesn't work let me know as I have some similar code in production and I can fix it later today easily if there is a problem.

    Actually let me know how it goes either way
  • Ryanp: If you're still involved in this project, this code snippit no longer works for the latest version of OSTicket, can you please post a new mod for this section of the code? I need to restrict the department(s) list to just the department(s) a user is a member of.

  • Almost a year, but I hope this can help in version 1.9.4:
    edit and go to the line 175 and edit like this:

    if($depts=Dept::getDepartments()) {
    foreach($depts as $id =>$name) {
    $dpto=new Dept($id);
    if ( in_array($id,$myDepts) || $dpto->isPublic() ) {
    echo sprintf('<option value="%d" %s>%s</option>',
    $id, ($info['deptId']==$id)?'selected="selected"':'',$name);

Sign In or Register to comment.