Assets and All Companies Design - edmozley/freeitsm GitHub Wiki
๐ข Assets and "All companies" - design
Started from #356 (pappas81). How this rule came to be, and the earlier decisions it builds on, are on its own page: All companies - how the design evolved. Related: All companies view ยท Moving an asset between companies ยท Multi-tenancy staff access.
The rule
The company selector at the top of the page decides what you see. A record's own company decides what you can pick.
- In a list, the selector chooses one company or all of them.
- When you add a record, you choose its company in the form. New asset has done this since 2.6.0.
- When you edit a record, its company is already known. Its dropdowns (type, status, location) come from that company, never from whichever company the selector last showed.
Once every way of editing follows the rule, showing every company in a list is safe, because it only shows more.
The problem it solves - a simple example
Two schools, each with its own locations:
- Oakwood: Library, Room 12
- Hillside: Sports Hall, Office
Say the asset list showed both schools, and the last school picked was Oakwood. You open Hillside's laptop, and the Location dropdown offers Library and Room 12, because the page loaded the dropdowns for the last school picked. You choose Library and save. Hillside's laptop is now "in Oakwood's Library", a place Hillside's staff cannot even see. Nothing warns you.
That is why the asset list was kept to one company in 2.6.0, and why it stays so until the rule above holds everywhere.
People do not have this problem. A person's name, email and phone number are typed in; there are no per-company dropdowns to mix up. That is why People can widen today.
Decisions
Put to Ed on 15 November 2026. His answers are what is built.
| Question | Decision | Why |
|---|---|---|
| Fix #356 (Assets -> People showing 4 people where Tickets -> Users showed 7)? | Yes. People, the list of who holds equipment and a person's panel follow All companies (5.4.0) | They have no per-company dropdowns; Tickets -> Users has widened with the same person editor since 2.6.0 |
| Widen the asset list at the same time? | Not yet. It stays on one company and says which, until the rule holds for every way an asset is edited | The 2.6.0 reason (below) still applies: an existing asset's dropdowns come from the selected company |
| What makes widening safe? | The rule above. An asset's dropdowns load for its own company, and the server refuses a type, status or location from another company | Simple to explain, already how New asset works, and it holds at any number of companies |
| Will this disturb a small install (for example three schools)? | No. Working in one company, nothing changes at any step; only the All companies view behaves differently | Both the three-schools install and a provider with thousands of clients were considered |
| Record how the design changed | Yes. A separate page, linked from here | So the reasoning behind each step is not lost the next time it is questioned |
Trade-offs considered
| Step | Change | Handled by |
|---|---|---|
| People widen | Adding a person under All companies saves them to the last company picked (Tickets -> Users has always done so) | Later: ask which company, as New asset does |
| People widen | Assigning a laptop could offer a person from another company | To be settled with the asset step - a holder in the asset's own company |
| Server check | A REST API caller that sets another company's location today gets an error afterwards | Said in the release notes |
| Server check | Assets that already carry another company's value | Only the field being changed is checked, so other edits are not blocked; a Maintenance list can show them |
| Asset list widens | Exporting under All companies includes every company in one file | The export says which companies it holds |
| Asset list widens | Changing many assets at once across companies | There is no bulk edit today (multi-select only prints labels); any future one uses each asset's own company |
| Asset list widens | Very large lists for providers with thousands of clients | Search and filters; part of the wider "many companies" work, with #358 (the company picker) |
Every way an asset is changed (audit, 15 November 2026)
| Path | Goes through | Follows the asset's own company today? |
|---|---|---|
| Edit screen and quick edits | AssetsService::updateFields() |
โ dropdowns come from the selected company |
| Scan page | updateFields() |
โ same |
| REST API field update | updateFields() |
โ the server checks only that the value exists |
| Starters: returning kit with a status | updateFields() |
โ status list from the selected company |
| Intune setting the type | updateFields() |
โ already checks the asset's own company |
| Import | its own code | โ looks values up in the import's company |
| Merge | its own code | โ refuses two assets from different companies |
| New asset | create_asset.php |
โ asks for the company, loads its lists |
| Bulk edit | - | โ none exists |
Almost every edit goes through one function, so one server check covers them all. Intune already picks the right company, so the check will not break it.
The plan
| Step | What | Status |
|---|---|---|
| 1 | People, holders and a person's panel follow All companies; the asset list says which company it shows | Done - 5.4.0 (#356, changelog #2953) |
| 2 | An asset's dropdowns load for its own company (edit screen, Scan, Starters); the server refuses another company's type, status or location | To do |
| 3 | The asset list, its lookup and its dashboard follow All companies, with the company on each row; exports say which companies they hold | After step 2 - Ed decides |
| 4 | "FreeITSM for many companies": what All companies should mean in each module (changes, CMDB, contracts), the company picker (#358), very large installs | Design to come |
For developers
activeTenantFilter()always answers with one company;activeTenantReadFilter()widens under All companies and is for list reads only, never writes. See the TRAP inincludes/tenancy.php.tests/assets-all-companies.phpchecks People, holders and a person's panel widen, and that the asset list does not - so it is not widened by accident before step 2.