Per Company SLAs PR Review - edmozley/freeitsm GitHub Wiki
Priorities and SLA calendars per company - PR review
PR #331 by nebev ยท Closes #320 ยท Verdict: merge, with fixes ยท 5.3.0
nebev's first contribution: each client company can have its own priorities, SLA targets and business hours beside the shared ones, and every priority picker and every channel that opens a ticket follows the ticket's company. It copies the shared-plus-own model ticket types already had, came with screenshots of every screen it touches, a 56-check test and a clear list of the decisions made. User guide: SLA Management. Internals: Per-company SLAs - Developer Guide.
What was checked
| Question | Result |
|---|---|
| Can one company read, use or change another's priority or calendar? | No - every settings write is checked against the row's stored company; the calendar picker is limited (shared priority โ shared calendars); listing endpoints show only reachable companies; CSRF on all six write endpoints |
| Can a ticket get a priority its company may not use, by any path? | No - UI, right-click, bulk edit, New Ticket, REST create/update (including a company move and a priority in one request), portal (including Raise with), email, messaging, web chat, catalogue, Zabbix, workflows ("Set ticket priority" refuses another company's), split/merge |
| The SLA calendar chain | Priority's calendar โ company default โ shared default โ none; never "first calendar" |
| The upgrade | Existing rows become shared and keep their defaults; the unique-key swap is safe to run twice; the schema files agree |
| A single-company install | Unchanged once Database Verification has run |
| REST | GET /priorities without company_id byte-identical; with it, 403 for a key that cannot reach the company |
The PR merged onto main with no conflicts. On the test install: the PR's test, then catalogue, workflow, tasks, module-access, escaping and inline-handler tests all pass.
What was changed on merge
- Before Database Verification (the one blocker): the new code selected
tenant_idbefore the column existed - new tickets with no priority, every priority refused, SLA failing for every ticket.ticketPriorityTenancyReady()now gates every read and write; until Verification runs, every row is shared. Proved with the columns dropped on the test install, then restored exactly; kept as test part 4. - Cache-busters for the inbox script and styles, so browsers fetch the new pickers.
- Zabbix and Teams install-wide settings offer shared priorities only (a company's own "Disaster" mapping was possible); the tracker mapping labels each company's priority "P1 (Acme)".
- A REST update resending the ticket's current priority is no longer refused when the company has since hidden it.
- Showing a hidden shared priority is refused while the company has its own of the same name.
- English in the new settings screens goes through translations; the 40 new strings in all nine maintained languages; a paragraph in the SLA help; a Feature Bingo card; this write-up; nebev on the Contributors page.
Decided
- Editing a shared priority or calendar needs access to every company - stricter than ticket types, which allow it from the Default company. Kept, as nebev proposed: a shared row changes every company's SLAs, the same reasoning as shared asset locations (Ed, 2026-11-14).
Worth knowing
- The workflow lookups and
GET /prioritieswithoutcompany_idstill show every company's priority names, labelled - the same as ticket types today. - The same "two identical names" gap in the workflow editor that this PR fixed for priorities still exists for ticket types; nebev pointed out the one-line fix.