When you say
anaconda when the Staff or Agent opens a ticket
Do you mean views a ticket?
Or do you mean then an Agent creates a new ticket [for a User]?
If you mean view then that information is at the top of the ticket, left hand column third item down.
If you mean when an Agent creates a new ticket, then the ticket does not have a department until a department is selected. If you mean that you want to limit the option in the drop down box to just show the options of any departments that the agent has access to, then this i snot a feature in osTicket at this time.