Repository navigation
Network Mapper Knowledge and Export Developer Guide
GH #433 Β· November 2026 Β· commits 46932b933 (Knowledge articles on diagrams, changelog #3168) and 16ec16c0a (PNG / PDF to Download or Save to Files, changelog #3169)
The basics of the editor (the window.NM module, the three original tables, whole-diagram saves, versions) are on Network Mapper - Developer Guide. This page does not repeat them. Shapes, pages, layers and groups are on Network Mapper - Shapes and Layers - Developer Guide, and the icon libraries and My images on Network Mapper - Icon Libraries - Developer Guide.
Knowledge links. A node or a shape on a diagram can point at ONE Knowledge article (the runbook for that switch). A small book in its corner opens the article, and in Present a plain click on the item does the same. The diagram as a whole can also have a list of related articles (the Articles button on the toolbar), and every article lists back the diagrams that use it, under Network diagrams when it is read in Knowledge. The one rule that shapes all the code: a diagram never shows an article's title to someone Knowledge would not show the article to. An article the viewer cannot read is still drawn, as "An article you don't have access to", with its id and no title, so nobody quietly deletes a colleague's link they cannot see.
Export. PNG and PDF used to download straight away. Now they open a two-item menu: Download, or Save to Files. Save to Files reuses the shared dialog from Save to Files - Developer Guide, which learned a new source: a file the page has just made in the browser (SaveToFiles.open({ blob, name })). The server takes only export formats (PNG, JPEG, PDF, CSV, XLSX), checks the bytes match the name, and then saves exactly as any other save into Files: Files module, Upload on the folder, the same name-clash choices as an upload. Any other page with an export can offer the same thing in about five lines (see Adding Save to Files to another page's export).
Key: ποΈ schema Β· π read Β· βοΈ write Β· π cross-module Β· π₯οΈ UI Β· π security Β· π§ͺ test
| π¨ | File | What it does |
|---|---|---|
| ποΈ | database/freeitsm.sql |
article_id (+ index + FK ON DELETE SET NULL) on network_diagram_nodes and network_diagram_shapes; the new network_diagram_articles table |
| ποΈ | includes/db_verify_schema.php |
The same columns and table for DB Verify to add |
| ποΈ | includes/db_verify_indexes.php |
ix_net_node_article, ix_net_shape_article, uq_net_diag_article, ix_net_diag_article (GENERATED - never hand-edited) |
| ποΈ | api/system/db_verify.php |
The five new foreign keys, and the orphan clean-up that runs before they are added |
| πβοΈπ | includes/services/network_articles.php |
NetworkArticleService - every rule about which article ids may be read, shown, saved, added and listed back |
| βοΈ | includes/services/network_mapper.php |
createDiagram() / saveDiagram() call allowedForSave() before the transaction; replaceContents() / replaceShapes() keep only allowed ids; createVersion() copies article_id and calls copyRelated()
|
| βοΈ | api/network-mapper/save_diagram.php |
Passes each node's article_id through to the service |
| π | api/network-mapper/get_diagram.php |
Returns article_id on every node and shape, plus articles (related, titles) and can_read_knowledge
|
| πβοΈ | api/network-mapper/articles.php |
GET ?q= (picker), GET ?article_id= (the Knowledge side), POST {action: add / remove} (related list) |
| π | includes/knowledge/visibility.php |
knowledgeVisibilitySql(), KnowledgeViewer::forAnalyst() - Knowledge's own read rule, used for every title |
| π₯οΈ |
assets/js/network-mapper.js (v=19) |
kbRelated, kbTitles, canReadKb, addKbMark(), renderKbField(), openArticlePicker(), the Articles dropdown, Present-mode click, right-click items, article_id in the save payload |
| π₯οΈ | network-mapper/diagram.php |
The Articles toolbar button and dropdown, the Article line in the node panel, the #articlePickerModal, the .nm-kb-* CSS |
| π₯οΈ | network-mapper/help.php |
One more help paragraph |
| π |
assets/js/knowledge.js (v=75) |
kbMountDiagrams() - the "Network diagrams" card under an article |
| π | knowledge/index.php |
window.KB_SHOW_DIAGRAMS - true only for someone with the Network Mapper module |
| π | includes/analyst_lifecycle.php |
network_diagram_articles.created_by_analyst_id registered as history
|
| π | includes/feature_bingo/cards/network-mapper.php |
Card network-mapper.articles - "Diagrams that link to Knowledge" |
| π₯οΈ |
lang/en/network-mapper.php, lang/en/knowledge.php (and 22 other locales) |
network-mapper.kb.*, network-mapper.menu.open_article / link_article, knowledge.diagrams.*
|
| π§ͺ | tests/network-mapper-articles.php |
15 checks plus clean-up - see Tests |
| π¨ | File | What it does |
|---|---|---|
| π₯οΈ |
assets/js/network-mapper.js (v=20) |
exportMenu(), deliverExport(), exportPng(mode) (canvas.toBlob), exportPdf(mode) (doc.output('blob')) |
| π₯οΈ | network-mapper/diagram.php |
Buttons call NM.exportMenu(event, 'png' / 'pdf'); window.NM_FILES; loads assets/js/save-to-files.js (?v=3) and assets/css/save-to-files.css (?v=1) |
| ππ₯οΈ |
assets/js/save-to-files.js (v=3) |
SaveToFiles.open({ blob, name }) and sendExport() - a multipart POST |
| π₯οΈ | assets/css/save-to-files.css |
The dialog's look (unchanged) |
| βοΈπ | api/files/save_from.php |
The new multipart branch: is_uploaded_file(), then FilesSave::saveExport()
|
| βοΈπ | includes/services/files_save.php |
FilesSave::EXPORT_TYPES and FilesSave::saveExport(); filesStoreLocalFile() does the write |
| π | includes/files/acl.php |
FilesAcl::level() / FilesAcl::UPLOAD - the folder check |
| π | assets/js/csrf.js |
Adds X-CSRF-Token to the fetch() POST, so sendExport() needs nothing of its own |
| π |
includes/documents_panel.php, tickets/index.php
|
Cache-buster for assets/js/save-to-files.js bumped to ?v=3 (see Traps) |
| π₯οΈ |
lang/en/network-mapper.php (and 22 other locales) |
network-mapper.help.export_tip |
| π§ͺ | tests/files-save-export.php |
9 checks plus clean-up - see Tests |
Two kinds of link, two shapes of storage.
One article per item is a nullable column on the item. From database/freeitsm.sql:
CREATE TABLE IF NOT EXISTS `network_diagram_nodes` (
...
-- A Knowledge article the node links to (click in Present; the book marker or right-click menu in the editor).
-- Who may read it is Knowledge's own rule - the diagram never shows a title past it.
`article_id` INT NULL,
`is_demo` TINYINT(1) NOT NULL DEFAULT 0, -- set by the demo data importer (#1297)
PRIMARY KEY (`id`),
KEY `ix_net_node_diag` (`diagram_id`),
KEY `ix_net_node_cmdb` (`cmdb_object_id`),
KEY `ix_net_node_article` (`article_id`),
CONSTRAINT `fk_net_node_diag` FOREIGN KEY (`diagram_id`) REFERENCES `network_diagrams` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk_net_node_cmdb` FOREIGN KEY (`cmdb_object_id`) REFERENCES `cmdb_objects` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk_net_node_article` FOREIGN KEY (`article_id`) REFERENCES `knowledge_articles` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; `article_id` INT NULL, -- as network_diagram_nodes.article_id
...
KEY `ix_net_shape_article` (`article_id`),
CONSTRAINT `fk_net_shape_diag` FOREIGN KEY (`diagram_id`) REFERENCES `network_diagrams` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk_net_shape_article` FOREIGN KEY (`article_id`) REFERENCES `knowledge_articles` (`id`) ON DELETE SET NULLON DELETE SET NULL is the point: when an article is deleted for good, the switch stays on the diagram and only loses its book. The item is the diagram's content; the link is a decoration on it.
Many related articles per diagram is its own table:
-- GH #433: Knowledge articles related to a diagram as a whole ("Articles" in the editor), and
-- listed back on the article as "Network diagrams". One row per diagram VERSION - a new
-- version copies them. Titles are only ever shown through Knowledge's own read rule.
CREATE TABLE IF NOT EXISTS `network_diagram_articles` (
`id` INT NOT NULL AUTO_INCREMENT,
`diagram_id` INT NOT NULL,
`article_id` INT NOT NULL,
`created_by_analyst_id` INT NULL,
`created_datetime` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uq_net_diag_article` (`diagram_id`, `article_id`),
KEY `ix_net_diag_article` (`article_id`),
CONSTRAINT `fk_net_da_diag` FOREIGN KEY (`diagram_id`) REFERENCES `network_diagrams` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk_net_da_article` FOREIGN KEY (`article_id`) REFERENCES `knowledge_articles` (`id`) ON DELETE CASCADE,
CONSTRAINT `fk_net_da_analyst` FOREIGN KEY (`created_by_analyst_id`) REFERENCES `analysts` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;-
uq_net_diag_articlemakes "add it twice" a no-op:addRelated()usesINSERT IGNORE, so a double click or two people adding the same article at once leaves one row. -
ix_net_diag_articleserves the reverse lookup, "which diagrams use article N", which the unique key (diagram first) cannot. -
Both FKs to the diagram and the article CASCADE, because a row in this table is nothing but the link. The author FK is
SET NULL: the link outlives the analyst who made it. -
idorder is the display order.forDiagram()readsORDER BY id, so the list shows in the order articles were added.
includes/db_verify_schema.php lists the columns so an existing install gets them:
'group_key' => 'VARCHAR(40) NULL', // GH #433: Group / Ungroup
'article_id' => 'INT NULL', // GH #433: a linked Knowledge article // GH #433: Knowledge articles related to a diagram (includes/services/network_articles.php)
'network_diagram_articles' => [
'id' => 'INT NOT NULL AUTO_INCREMENT',
'diagram_id' => 'INT NOT NULL',
'article_id' => 'INT NOT NULL',
'created_by_analyst_id' => 'INT NULL',
'created_datetime' => 'DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
],A foreign key cannot be added while a row points at something that is gone, so api/system/db_verify.php cleans orphans first, using the same semantics the FK will have (SET NULL on the items, DELETE on the link rows):
// GH #433: an article that is gone stops being linked (SET NULL / CASCADE semantics).
if ($tableExists('knowledge_articles')) {
foreach (['network_diagram_nodes', 'network_diagram_shapes'] as $nt) {
if ($tableExists($nt) && $colExists($nt, 'article_id')) {
$conn->exec("UPDATE $nt x LEFT JOIN knowledge_articles a ON a.id = x.article_id SET x.article_id = NULL WHERE x.article_id IS NOT NULL AND a.id IS NULL");
}
}
if ($tableExists('network_diagram_articles')) {
$conn->exec("DELETE x FROM network_diagram_articles x LEFT JOIN knowledge_articles a ON a.id = x.article_id WHERE a.id IS NULL");
$conn->exec("DELETE x FROM network_diagram_articles x LEFT JOIN network_diagrams d ON d.id = x.diagram_id WHERE d.id IS NULL");
$conn->exec("UPDATE network_diagram_articles x LEFT JOIN analysts an ON an.id = x.created_by_analyst_id SET x.created_by_analyst_id = NULL WHERE x.created_by_analyst_id IS NOT NULL AND an.id IS NULL");
}
}Then the keys themselves, in the same list as every other Network Mapper FK:
['network_diagram_nodes', 'fk_net_node_article', "ALTER TABLE network_diagram_nodes ADD CONSTRAINT fk_net_node_article FOREIGN KEY (article_id) REFERENCES knowledge_articles (id) ON DELETE SET NULL"],
['network_diagram_shapes', 'fk_net_shape_article', "ALTER TABLE network_diagram_shapes ADD CONSTRAINT fk_net_shape_article FOREIGN KEY (article_id) REFERENCES knowledge_articles (id) ON DELETE SET NULL"],
['network_diagram_articles', 'fk_net_da_diag', "ALTER TABLE network_diagram_articles ADD CONSTRAINT fk_net_da_diag FOREIGN KEY (diagram_id) REFERENCES network_diagrams (id) ON DELETE CASCADE"],
['network_diagram_articles', 'fk_net_da_article', "ALTER TABLE network_diagram_articles ADD CONSTRAINT fk_net_da_article FOREIGN KEY (article_id) REFERENCES knowledge_articles (id) ON DELETE CASCADE"],
['network_diagram_articles', 'fk_net_da_analyst', "ALTER TABLE network_diagram_articles ADD CONSTRAINT fk_net_da_analyst FOREIGN KEY (created_by_analyst_id) REFERENCES analysts (id) ON DELETE SET NULL"],The four indexes live in includes/db_verify_indexes.php, which is generated from database/freeitsm.sql by its script. Run the script; do not type them in.
created_by_analyst_id is an analyst reference, so it is registered in analystReferenceRegistry() in includes/analyst_lifecycle.php:
['network_diagram_articles', 'created_by_analyst_id', 'history'], // GH #433history is the lifecycle's "who did what" category: the reference is kept and still credited to the analyst, and a row here means the analyst cannot be hard-deleted (Deactivate or Anonymise instead). Registering it is what makes the leaver screens and tests/analyst-lifecycle.php know the column exists. The FK's ON DELETE SET NULL is only the database's safety net if a row is ever removed some other way. See Analysts Leaving for the user side.
Everything in this feature reads titles through one function, NetworkArticleService::readable(), and that function asks Knowledge, never its own SQL:
public static function readable(PDO $conn, int $analystId, array $ids): array
{
return array_map(fn($r) => $r['title'], self::readableRows($conn, $analystId, $ids));
}
public static function readableRows(PDO $conn, int $analystId, array $ids): array
{
$ids = array_values(array_unique(array_filter(array_map('intval', $ids), fn($i) => $i > 0)));
if (!$ids || $analystId <= 0 || !analystCanAccessModule($conn, $analystId, 'knowledge')) return [];
[$vis, $args] = knowledgeVisibilitySql($conn, KnowledgeViewer::forAnalyst($conn, $analystId), 'a', ['lifecycle' => 'any']);
$ph = implode(',', array_fill(0, count($ids), '?'));
$st = $conn->prepare("SELECT a.id, a.title, a.is_published, a.is_archived FROM knowledge_articles a WHERE a.id IN ($ph)" . $vis);
$st->execute(array_merge($ids, $args));
$out = [];
foreach ($st->fetchAll(PDO::FETCH_ASSOC) as $r) $out[(int)$r['id']] = ['title' => (string)$r['title'], 'state' => self::stateOf($r)];
return $out;
}
private static function stateOf(array $r): string
{
if ((int)($r['is_archived'] ?? 0) === 1) return 'archived';
return (int)($r['is_published'] ?? 1) === 1 ? 'live' : 'draft';
}Why it is built this way:
-
No Knowledge module, no titles at all.
analystCanAccessModule($conn, $analystId, 'knowledge')is checked first. Someone who only has Network Mapper sees every link as "An article you don't have access to". This matters because diagrams are install-wide: everyone with Network Mapper opens the same diagram. -
knowledgeVisibilitySql()is the same clause the Knowledge list uses - with one deliberate difference:lifecycle => 'any'. The default,live(published and not archived), is right for a list of articles to read and wrong for a link that already exists: an analyst opens drafts (with their Draft badge) and archived articles in Knowledge, so calling them "no access" on a diagram was untrue. Lifting the lifecycle lifts nothing else - the clause still applies the company scope (tenant_id IS NULLmeans shared with every company in Knowledge), the audience rung, and the folder access lists. Re-deriving any of that here would be the classic way for two readers of one table to disagree. The design of that clause, and whyknowledgeCanRead()is built on it, is on Knowledge folders and security - Developer Guide. -
The administrator floor applies.
knowledgeVisibilitySql()is called withoutno_admin_floor, so an analyst withCap::KNOWLEDGE_MANAGEpasses the access-list part and sees every title. This is a list read, so (as in Knowledge's own list) noadmin_overrideaudit row is written; the audit row belongs toknowledgeCanRead(), the single-article open, which Knowledge itself does when the person actually opens the article. -
One query for all ids. A diagram can carry dozens of links;
IN (...)plus the visibility clause keeps it to one round trip. -
The answer is a map of readable ids only. An id the viewer cannot read is simply missing. Callers turn "missing" into
null, never into a title. -
The state travels with the title.
forDiagram()addsstates({id: 'draft' | 'archived'}, published ones left out) andsearch()gives each row astate; the editor'skbLabel()appends " (Draft)" / " (Archived)" (network-mapper.kb.state_draft/state_archived, in every language), so a reader knows before clicking.
includes/services/network_articles.php. It pulls in includes/knowledge/visibility.php itself, so any caller gets the rule by including the service.
public static function idsOnDiagram(PDO $conn, int $diagramId): array
{
$ids = [];
foreach (["SELECT article_id FROM network_diagram_nodes WHERE diagram_id = ? AND article_id IS NOT NULL",
"SELECT article_id FROM network_diagram_shapes WHERE diagram_id = ? AND article_id IS NOT NULL",
"SELECT article_id FROM network_diagram_articles WHERE diagram_id = ?"] as $sql) {
try {
$st = $conn->prepare($sql);
$st->execute([$diagramId]);
foreach ($st->fetchAll(PDO::FETCH_COLUMN) as $id) $ids[(int)$id] = true;
} catch (PDOException $e) {
// the column or table is not there yet
}
}
return array_keys($ids);
}Three sources, one de-duplicated set (array keys). Each query has its own try, so an install that has the table but not yet the column (DB Verify not run since upgrading) still opens its diagrams. That fallback pattern runs right through this file.
public static function allowedForSave(PDO $conn, int $analystId, int $diagramId, array $wanted): array
{
$wanted = array_values(array_unique(array_filter(array_map('intval', $wanted), fn($i) => $i > 0)));
if (!$wanted) return [];
$allowed = array_fill_keys(self::idsOnDiagram($conn, $diagramId), true);
$new = array_values(array_filter($wanted, fn($i) => !isset($allowed[$i])));
foreach (array_keys(self::readable($conn, $analystId, $new)) as $id) $allowed[$id] = true;
return $allowed;
}A save sends every node and shape, each with its article_id. Two things must both be true:
- A colleague's link survives my save. Ann links the core switch to a Restricted runbook. Bob, who cannot read it, moves a box and saves. The whole diagram is replaced on save, so if the rule were "keep only what the saver can read", Bob's save would silently strip Ann's link. So anything already on the diagram is allowed, readable or not.
-
A typed-in id is not accepted. Bob crafts a save request with
article_id: 999on a shape, where 999 is a Restricted article he cannot read. He would then see "An article you don't have access to" on the diagram, which is harmless, but it would also put the article on its "Network diagrams" list, and let him pin someone else's private document onto a public diagram. So a new id is allowed only if the saver can read it.
Only the new ids go to readable(), which keeps the query small on a big diagram where nothing changed.
It must run before the transaction. The save deletes and re-inserts every node and shape, so once the replace has started, idsOnDiagram() would return nothing and rule 1 would quietly fail. NetworkMapperService computes it first, in both createDiagram() (diagram id 0, so only readable ids are allowed) and saveDiagram():
// GH #433: which article links this save may keep (see NetworkArticleService::allowedForSave).
$articles = NetworkArticleService::allowedForSave($conn, (int)$ctx->actorId, $diagramId, array_merge(
array_map(fn($x) => is_array($x) ? (int)($x['article_id'] ?? 0) : 0, is_array($in['nodes'] ?? null) ? $in['nodes'] : []),
array_map(fn($x) => is_array($x) ? (int)($x['article_id'] ?? 0) : 0, is_array($in['shapes'] ?? null) ? $in['shapes'] : [])));
$conn->beginTransaction();The is_array() guards are there because $in is untrusted JSON: a node that is a string, or nodes that is not a list, must not throw before the real validation runs.
The allowed set is then passed into the two replace functions, and each row keeps its id only if it is in the set:
$insertNode->execute([$diagramId, $objectId, $x, $y, $size, $icon, $colour, $w, $h, $style,
self::keyOf($n['page_key'] ?? 0), self::keyOf($n['layer_key'] ?? 0), self::groupOf($n['group_key'] ?? null),
isset($articles[(int)($n['article_id'] ?? 0)]) ? (int)$n['article_id'] : null]); // GH #433 (is_string($s['uid'] ?? null) && preg_match('/^[A-Za-z0-9_-]{1,20}$/', $s['uid'])) ? $s['uid'] : null,
isset($articles[(int)($s['article_id'] ?? 0)]) ? (int)$s['article_id'] : null, // GH #433A refused id is not an error, it saves as "no article". That matches how the rest of replaceShapes() treats bad input (an icon_id that does not exist also saves as no icon): the save of a big diagram should not fail because one field on one shape was wrong.
api/network-mapper/save_diagram.php had to pass the field through, because it rebuilds each node before calling the service:
'group_key' => $n['group_key'] ?? null,
'article_id' => $n['article_id'] ?? null, // GH #433: a linked Knowledge article
'ref' => (string)$ref, public static function forDiagram(PDO $conn, int $analystId, int $diagramId): array
{
$related = [];
try {
$st = $conn->prepare("SELECT article_id FROM network_diagram_articles WHERE diagram_id = ? ORDER BY id");
$st->execute([$diagramId]);
$related = array_map('intval', $st->fetchAll(PDO::FETCH_COLUMN));
} catch (PDOException $e) {
$related = [];
}
$all = self::idsOnDiagram($conn, $diagramId);
$can = self::readable($conn, $analystId, $all);
$titles = [];
foreach ($all as $id) $titles[(string)$id] = $can[$id] ?? null;
return ['related' => $related, 'titles' => $titles];
}related is just ids, in order. titles has a key for every linked article, with the title or null. The JS never has to ask "do I know this id?": a key with null means "linked, but not for you", and the server has not sent the title. The keys are strings so the JSON is an object, not a list.
public static function addRelated(PDO $conn, ActorContext $ctx, int $diagramId, int $articleId): void
{
self::requireCurrent($conn, $diagramId);
if (!self::readable($conn, (int)$ctx->actorId, [$articleId])) {
throw new ServiceError('not_found', 'not_found', 'Article not found.');
}
$conn->prepare("INSERT IGNORE INTO network_diagram_articles (diagram_id, article_id, created_by_analyst_id, created_datetime)
VALUES (?, ?, ?, UTC_TIMESTAMP())")->execute([$diagramId, $articleId, $ctx->actorId ?: null]);
}
public static function removeRelated(PDO $conn, int $diagramId, int $articleId): void
{
self::requireCurrent($conn, $diagramId);
$conn->prepare("DELETE FROM network_diagram_articles WHERE diagram_id = ? AND article_id = ?")->execute([$diagramId, $articleId]);
}- Add needs read access; remove does not. You may only add an article you can read, but you may take any link off, including one you cannot read. That is how an ordinary diagram edit already works: anyone who can edit the diagram can delete a box.
-
"Not readable" and "does not exist" are the same
not_found. An id cannot be probed to learn whether a Restricted article exists. - These write straight away, not on Save. The related list is not part of the diagram payload, so a related-list change cannot be lost to "leave without saving", and it cannot collide with someone else's unsaved canvas.
-
Current version only, through
requireCurrent():
private static function requireCurrent(PDO $conn, int $diagramId): void
{
$st = $conn->prepare("SELECT (SELECT COUNT(*) FROM network_diagrams c WHERE c.parent_diagram_id = d.id) FROM network_diagrams d WHERE d.id = ?");
$st->execute([$diagramId]);
$children = $st->fetchColumn();
if ($children === false) throw new ServiceError('not_found', 'not_found', 'Diagram not found.');
if ((int)$children > 0) throw new ServiceError('conflict', 'conflict', 'This is a historical version (read-only).');
}One query tells "no such diagram" (fetchColumn() is false, no row) apart from "historical version" (a row with children). A version with a child is frozen history, as everywhere else in the module.
public static function copyRelated(PDO $conn, int $fromId, int $toId): void
{
try {
$conn->prepare("INSERT INTO network_diagram_articles (diagram_id, article_id, created_by_analyst_id, created_datetime)
SELECT ?, article_id, created_by_analyst_id, created_datetime FROM network_diagram_articles WHERE diagram_id = ?")
->execute([$toId, $fromId]);
} catch (PDOException $e) {
// table not there yet
}
}NetworkMapperService::createVersion() calls it inside its transaction, right after copying pages and layers. It copies the original author and time, so "who added this" stays true across versions. Item links travel with the items in the same function:
"INSERT INTO network_diagram_nodes (diagram_id, cmdb_object_id, x, y, size, icon_override, colour_override, w, h, style, page_key, layer_key, group_key, article_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
...
(int)($n['page_key'] ?? 0), (int)($n['layer_key'] ?? 0), $n['group_key'] ?? null,
isset($n['article_id']) ? (int)$n['article_id'] : null]); "INSERT INTO network_diagram_shapes (diagram_id, shape_type, x, y, w, h, rotation, text, style, layer, z, icon_id, page_key, layer_key, group_key, uid, article_id)
SELECT ?, shape_type, x, y, w, h, rotation, text, style, layer, z, icon_id, page_key, layer_key, group_key, uid, article_id FROM network_diagram_shapes WHERE diagram_id = ? ORDER BY id"Versioning is a server-side copy, not a save, so allowedForSave() is not involved: every link is copied, readable by the person making the version or not. That is rule 1 again (a colleague's link survives).
public static function search(PDO $conn, int $analystId, string $q): array
{
if ($analystId <= 0 || !analystCanAccessModule($conn, $analystId, 'knowledge')) return [];
[$vis, $args] = knowledgeVisibilitySql($conn, KnowledgeViewer::forAnalyst($conn, $analystId), 'a', ['lifecycle' => 'unarchived']);
$q = trim($q);
$where = '';
if ($q !== '') {
$where = ' AND a.title LIKE ?';
$args[] = '%' . str_replace(['\\', '%', '_'], ['\\\\', '\\%', '\\_'], $q) . '%';
}
$st = $conn->prepare("SELECT a.id, a.title, a.is_published, a.is_archived FROM knowledge_articles a WHERE 1 = 1" . $vis . $where . "
ORDER BY " . ($q !== '' ? 'a.title' : 'COALESCE(a.modified_datetime, a.created_datetime) DESC') . " LIMIT 40");
$st->execute($args);
return array_map(fn($r) => ['id' => (int)$r['id'], 'title' => (string)$r['title'], 'state' => self::stateOf($r)], $st->fetchAll(PDO::FETCH_ASSOC));
}- The picker can only offer what Knowledge would list for this person, so a Restricted article cannot even be found by title.
-
lifecycle => 'unarchived': drafts are offered (a runbook is often linked while it is still being written) and marked Draft in the list; archived articles are not offered - an existing link to one keeps working, but nobody should pick one new. -
%,_and\in what was typed are escaped, so typing100%searches for that text rather than "anything starting 100". - With nothing typed it shows the 40 most recently changed articles, which is usually the one just written for this diagram.
- The
ORDER BYis one of two fixed strings, never built from input.
public static function diagramsForArticle(PDO $conn, int $analystId, int $articleId): array
{
if ($articleId <= 0 || !analystCanAccessModule($conn, $analystId, 'network-mapper')) return [];
if (!self::readable($conn, $analystId, [$articleId])) return [];
$how = [];
foreach (['related' => "SELECT diagram_id FROM network_diagram_articles WHERE article_id = ?",
'item' => "SELECT diagram_id FROM network_diagram_nodes WHERE article_id = ?
UNION SELECT diagram_id FROM network_diagram_shapes WHERE article_id = ?"] as $kind => $sql) {
try {
$st = $conn->prepare($sql);
$st->execute($kind === 'item' ? [$articleId, $articleId] : [$articleId]);
foreach ($st->fetchAll(PDO::FETCH_COLUMN) as $d) $how[(int)$d] = $how[(int)$d] ?? $kind;
} catch (PDOException $e) {
// not there yet
}
}
if (!$how) return [];
$ph = implode(',', array_fill(0, count($how), '?'));
$st = $conn->prepare("SELECT d.id, d.title, d.version_label FROM network_diagrams d
WHERE d.id IN ($ph) AND NOT EXISTS (SELECT 1 FROM network_diagrams c WHERE c.parent_diagram_id = d.id)
ORDER BY d.title");
$st->execute(array_keys($how));
return array_map(fn($r) => ['id' => (int)$r['id'], 'title' => (string)$r['title'], 'version_label' => $r['version_label'],
'how' => $how[(int)$r['id']]], $st->fetchAll(PDO::FETCH_ASSOC));
}- Two gates. The reader needs the Network Mapper module (otherwise the list would name diagrams in a module they cannot open), and must be able to read the article (otherwise the endpoint becomes a way to learn which diagrams use a Restricted article, by id).
-
Current versions only (
NOT EXISTSa child). Every version keeps its own copy of the links, so without that filter one diagram with five versions would be listed five times. -
howisrelatedoritem. Related is checked first and??keeps the first answer, so a diagram that does both is shown as "Related to the diagram".
A thin adapter. The order of the checks is the interesting part:
if ($method === 'GET' && isset($_GET['article_id'])) {
echo json_encode(['success' => true, 'diagrams' => NetworkArticleService::diagramsForArticle($conn, $analystId, (int)$_GET['article_id'])]);
exit;
}
requireModuleAccessJson('network-mapper');
if ($method === 'GET') {
echo json_encode(['success' => true, 'can_read' => analystCanAccessModule($conn, $analystId, 'knowledge'),
'articles' => NetworkArticleService::search($conn, $analystId, (string)($_GET['q'] ?? ''))]);
exit;
}GET ?article_id= is answered before requireModuleAccessJson('network-mapper'), because it is called from the Knowledge reader, by people who may not have Network Mapper. For them the answer must be an empty list, not a 403 that the Knowledge page would have to handle. The service already returns [] without the module, so nothing leaks. Everything after that line is Network Mapper's own and needs the module.
The POST half:
$data = json_decode(file_get_contents('php://input'), true) ?: [];
$action = (string)($data['action'] ?? '');
$diagramId = (int)($data['diagram_id'] ?? 0);
$articleId = (int)($data['article_id'] ?? 0);
if ($action === 'add') {
NetworkArticleService::addRelated($conn, ActorContext::fromSession($conn), $diagramId, $articleId);
} elseif ($action === 'remove') {
NetworkArticleService::removeRelated($conn, $diagramId, $articleId);
} else {
http_response_code(400);
echo json_encode(['success' => false, 'error' => 'Unknown action']);
exit;
}
echo json_encode(['success' => true] + NetworkArticleService::forDiagram($conn, $analystId, $diagramId));Both actions answer with the fresh forDiagram() result, so the editor replaces its list and titles from the server instead of guessing what changed. The CSRF token comes from assets/js/csrf.js, which adds X-CSRF-Token to every same-origin fetch().
Nodes and shapes now select article_id and cast it:
$n['article_id'] = $n['article_id'] !== null ? (int)$n['article_id'] : null; // GH #433 $s['article_id'] = $s['article_id'] !== null ? (int)$s['article_id'] : null;The shapes query already had an "older install" fallback; it gains NULL AS article_id so an install between upgrades still opens. Then the two new keys in the answer:
// GH #433: Knowledge articles - the related list, and a title for each linked article that
// this analyst may read (null = linked, but not one they can read: no title is sent).
$articles = ['related' => [], 'titles' => new stdClass()];
try {
require_once '../../includes/services/network_articles.php';
$articles = NetworkArticleService::forDiagram($conn, (int)$_SESSION['analyst_id'], $id);
if (!$articles['titles']) $articles['titles'] = new stdClass();
} catch (Exception $e) {
// Knowledge not set up on this install - the diagram still opens
}
echo json_encode(['success' => true, 'diagram' => $d, 'nodes' => $nodes, 'connectors' => $conns, 'shapes' => $shapes, 'pages' => $pages, 'layers' => $layers,
'articles' => $articles, 'can_read_knowledge' => analystCanAccessModule($conn, (int)$_SESSION['analyst_id'], 'knowledge')]);-
new stdClass()makes an emptytitlesencode as{}. An empty PHP array would encode as[], and the JS would then treat it as a list. - The whole block is in a
try: a missing Knowledge table must not stop a diagram opening. -
can_read_knowledgeis "has the Knowledge module". The editor uses it to decide whether to offer the picker at all.
let kbRelated = []; // article ids related to this diagram, in the order added
let kbTitles = {}; // article id -> title, or null when linked but not readable by this analyst
let canReadKb = false; // has the Knowledge module - the picker needs it
let kbPick = null; // the picker's callback while it is open
let kbTimer = null, kbSeq = 0;Filled in loadDiagram():
kbRelated = (data.articles && data.articles.related) || []; // GH #433: Knowledge articles
kbTitles = (data.articles && data.articles.titles && !Array.isArray(data.articles.titles)) ? data.articles.titles : {};
canReadKb = !!data.can_read_knowledge;
renderArticlesPanel();The !Array.isArray() is the second half of the stdClass trick: if anything ever sends [], the editor still gets an object.
Two helpers decide every label on screen:
function kbTitle(id) { const v = kbTitles[id]; return typeof v === 'string' ? v : null; }
function kbLabel(id) { const v = kbTitle(id); return v !== null ? v : t('network-mapper.kb.no_access'); }kbTitle() returns null both for "not readable" and "never heard of it", so an id the editor has no title for is always treated as unreadable. Nothing can draw a title the server did not send.
function openArticle(id) {
if (!id) return;
if (kbTitle(id) === null) { if (window.showToast) showToast(t('network-mapper.kb.no_access'), 'error'); return; }
window.open('../knowledge/?article=' + encodeURIComponent(id), '_blank', 'noopener');
}It opens Knowledge in a new tab, so the diagram (and any unsaved work) stays put. Knowledge checks the article again when it opens; the kbTitle() check here only saves a pointless tab.
function addKbMark(el, it) {
if (!it.article_id) return;
el.classList.add('has-article');
const b = document.createElement('button');
b.type = 'button';
b.className = 'nm-kb-mark' + (kbTitle(it.article_id) === null ? ' is-hidden-article' : '');
b.title = kbLabel(it.article_id);
b.setAttribute('aria-label', kbLabel(it.article_id));
b.innerHTML = KB_BOOK;
b.addEventListener('mousedown', e => { e.stopPropagation(); e.preventDefault(); });
b.addEventListener('click', e => { e.stopPropagation(); openArticle(it.article_id); });
el.appendChild(b);
}It is called at the end of both renderNode() and renderShape(). The mousedown handler stops the event reaching the node, whose own mousedown would select it and start a drag. An unreadable article gets a grey book (.is-hidden-article). The CSS in network-mapper/diagram.php keeps it out of exports:
.nm-kb-mark {
position: absolute; top: -9px; right: -9px; z-index: 3; width: 20px; height: 20px; padding: 0;
display: flex; align-items: center; justify-content: center; border-radius: 50%; cursor: pointer;
border: 1px solid var(--nm-accent, #06b6d4); background: var(--surface, #fff); color: var(--nm-accent, #06b6d4);
box-shadow: 0 1px 3px rgba(0, 0, 0, .15);
}
.nm-kb-mark.is-hidden-article { border-color: var(--border, #e5e7eb); color: var(--text-faint, #9ca3af); }
.nm-canvas-inner.is-exporting .nm-kb-mark { display: none; }
.nm-editor.is-presenting .has-article { cursor: pointer; }In Present, a plain click on a linked item opens the article. It is the first thing the node and shape mousedown handlers check:
if (isPresenting() && n.article_id) { e.preventDefault(); openArticle(n.article_id); return; } // GH #433 if (isPresenting() && s.article_id) { e.preventDefault(); openArticle(s.article_id); return; } // GH #433 function renderKbField(host, it) {
if (!host) return;
host._kbItem = it;
const ed = canEdit();
const id = it.article_id;
const btn = (act, label) => '<button type="button" class="nm-detail-icon-btn" data-kb="' + act + '">' + escapeHtml(label) + '</button>';
let html;
if (id) {
const title = kbTitle(id);
html = '<span class="nm-kb-name' + (title === null ? ' is-hidden-article' : '') + '" title="' + escapeAttr(kbLabel(id)) + '">' + escapeHtml(kbLabel(id)) + '</span>'
+ (title !== null ? btn('open', t('network-mapper.kb.open')) : '')
+ (ed && canReadKb ? btn('change', t('network-mapper.kb.change')) : '')
+ (ed ? btn('remove', t('network-mapper.kb.remove')) : '');
} else if (ed && canReadKb) {
html = btn('change', t('network-mapper.kb.link'));
} else {
html = '<span class="nm-kb-none">' + escapeHtml(t('network-mapper.kb.none')) + '</span>';
}
host.innerHTML = html;
host.querySelectorAll('[data-kb]').forEach(b => b.addEventListener('click', () => {
if (b.dataset.kb === 'open') openArticle(id);
else if (b.dataset.kb === 'remove') setItemArticle(it, null);
else openArticlePicker(a => setItemArticle(it, a));
}));
}The buttons follow the same rules as the server: Open only for a readable article, Change and Link only with the Knowledge module (the picker would be empty otherwise), Remove for anyone who can edit, readable or not. host._kbItem remembers which item the panel is showing, so setItemArticle() can refresh the right panel:
function setItemArticle(it, a) {
it.article_id = a ? a.id : null;
if (a) kbTitles[a.id] = a.title;
if (nodes.includes(it)) { rerenderNode(it); renderConnectors(); } else { rerenderShape(it); }
markDirty();
['ndArticle', 'spArticle'].forEach(id => { const h = document.getElementById(id); if (h && h._kbItem === it) renderKbField(h, it); });
}An item link is part of the diagram, so it is saved by Save (markDirty()), not straight away. The title from the picker goes into kbTitles so the book shows it before the next load. The save payload carries it:
page_key: itemPage(n), layer_key: itemLayer(n), group_key: n.group_key || null,
article_id: n.article_id || null // GH #433 function onArticleSearchInput(v) { clearTimeout(kbTimer); kbTimer = setTimeout(() => searchArticles(v), 200); }
async function searchArticles(q) {
const box = document.getElementById('articleResults');
const seq = ++kbSeq;
try {
const r = await fetch(API + 'articles.php?q=' + encodeURIComponent(q || ''), { credentials: 'same-origin' });
const d = await r.json();
if (seq !== kbSeq) return; // a newer search has started
if (!d.success) throw new Error(d.error || 'failed');
const list = d.articles || [];
box.innerHTML = list.length
? list.map(a => '<div class="nm-picker-row" data-id="' + a.id + '"><span class="nm-picker-name">' + KB_BOOK + escapeHtml(a.title) + '</span></div>').join('')
: '<div class="nm-picker-empty">' + escapeHtml(t('network-mapper.kb.no_results')) + '</div>';
box.querySelectorAll('.nm-picker-row').forEach(row => row.addEventListener('click', () => {
const a = list.find(x => x.id === +row.dataset.id);
const cb = kbPick;
closeArticlePicker();
if (cb && a) cb(a);
}));
} catch (e) {
box.innerHTML = '<div class="nm-picker-empty">' + escapeHtml(e.message) + '</div>';
}
}- A 200 ms debounce, and
kbSeqso a slow early answer cannot overwrite a later one. - One picker serves three callers (item panel, right-click menu, related list) through the
kbPickcallback. It is copied tocbbeforecloseArticlePicker()clears it. - The modal is
#articlePickerModalinnetwork-mapper/diagram.php; Escape in its search box closes it.
function renderArticlesPanel() {
const lab = document.getElementById('articlesBtnCount');
if (lab) lab.textContent = String(kbRelated.length);
const dd = document.getElementById('articlesDropdown');
if (!dd || dd.style.display === 'none') return;
const ed = !!(diagram && diagram.is_current);
dd.innerHTML = '<div class="nm-layers-head">' + escapeHtml(t('network-mapper.kb.related_title')) + '</div>'
+ (kbRelated.length ? kbRelated.map(id => '<div class="nm-kb-row">'
+ (kbTitle(id) !== null
? '<a href="../knowledge/?article=' + encodeURIComponent(id) + '" target="_blank" rel="noopener">' + KB_BOOK + '<span>' + escapeHtml(kbTitle(id)) + '</span></a>'
: '<span class="is-hidden-article">' + KB_BOOK + '<span>' + escapeHtml(t('network-mapper.kb.no_access')) + '</span></span>')
+ (ed ? '<button type="button" class="nm-layer-ico nm-layer-del" data-del="' + id + '" title="' + escapeAttr(t('network-mapper.kb.remove')) + '">×</button>' : '')
+ '</div>').join('')
: '<div class="nm-kb-empty">' + escapeHtml(t('network-mapper.kb.related_empty')) + '</div>')
+ (ed && canReadKb ? '<button type="button" class="nm-layers-add" id="kbRelAdd">+ ' + escapeHtml(t('network-mapper.kb.related_add')) + '</button>' : '')
+ (!canReadKb ? '<div class="nm-layers-hint">' + escapeHtml(t('network-mapper.kb.no_knowledge')) + '</div>' : '')
+ '<div class="nm-layers-hint">' + escapeHtml(t('network-mapper.kb.related_hint')) + '</div>';
...
}It borrows the Layers dropdown's look (.nm-layers-head, .nm-layers-add, .nm-layer-del). The count on the button is updated even when the dropdown is closed. Edit rights here are diagram.is_current, not canEdit(), because the related list is written straight to the server and the server's rule is "current version", whatever the editor's lock or Present state.
Changes go straight to the endpoint and the list is rebuilt from its answer:
async function relatedPost(action, articleId) {
try {
const r = await fetch(API + 'articles.php', { method: 'POST', credentials: 'same-origin', headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action: action, diagram_id: diagramId, article_id: articleId }) });
const d = await r.json();
if (!d.success) throw new Error(d.error || 'failed');
kbRelated = d.related || [];
kbTitles = Object.assign({}, kbTitles, d.titles || {});
const dd = document.getElementById('articlesDropdown');
if (dd) dd.style.display = '';
renderArticlesPanel();
} catch (e) {
if (window.showToast) showToast(e.message, 'error');
}
}Object.assign merges rather than replaces the titles, so a title picked for an unsaved item link (which the server does not know about yet) is kept. The click-outside handler in init() leaves the dropdown open while the picker modal is in use:
const aDd = document.getElementById('articlesDropdown'), aBtn = document.getElementById('articlesBtn'); // GH #433
if (aDd && aDd.style.display !== 'none' && !(aBtn && aBtn.contains(e.target)) && !aDd.contains(e.target)
&& !e.target.closest('#articlePickerModal')) closeArticlesPanel();Both the node and the shape menu gain two items:
{ label: M('open_article'), disabled: !n.article_id || kbTitle(n.article_id) === null, act: () => openArticle(n.article_id) },
{ label: M('link_article'), disabled: !ed || !canReadKb, act: () => openArticlePicker(a => setItemArticle(n, a)) },Same rules again: Open needs a readable link, Link needs edit rights and the Knowledge module.
window.NM = {
toggleArticlesPanel, closeArticlePicker, onArticleSearchInput, // GH #433: Knowledge articles
init,
...Only what the inline onclick / oninput handlers in network-mapper/diagram.php need.
knowledge/index.php tells the page whether to ask at all:
window.KB_SHOW_DIAGRAMS = <?php echo analystCanAccessModule(connectToDatabase(), (int)$_SESSION['analyst_id'], 'network-mapper') ? 'true' : 'false'; ?>; // GH #433renderArticleDetail() in assets/js/knowledge.js adds <div id="kbDiagrams"> after the Projects card and mounts it:
// GH #433: the network diagrams that use this article - linked from the diagram's side.
if (window.KB_SHOW_DIAGRAMS) kbMountDiagrams(document.getElementById('kbDiagrams'), currentArticle.id);async function kbMountDiagrams(host, articleId) {
if (!host) return;
host.innerHTML = '';
host.hidden = true;
try {
const r = await fetch('../api/network-mapper/articles.php?article_id=' + encodeURIComponent(articleId), { credentials: 'same-origin' });
const d = await r.json();
const rows = (d && d.success && d.diagrams) || [];
if (!rows.length || !currentArticle || currentArticle.id !== articleId) return;
const how = x => window.t(x.how === 'related' ? 'knowledge.diagrams.related' : 'knowledge.diagrams.item');
host.innerHTML = '<div class="pl-card"><div class="pl-head"><span class="pl-title">' + escapeHtml(window.t('knowledge.diagrams.title'))
+ ' <span class="pl-count">' + rows.length + '</span></span></div><div class="pl-body"><ul class="pl-list">'
+ rows.map(x => '<li class="pl-row"><a class="pl-main" href="../network-mapper/diagram.php?id=' + encodeURIComponent(x.id) + '">'
+ '<span class="pl-dot" style="background:var(--nm-accent, #06b6d4)"></span>'
+ '<span class="pl-text"><span class="pl-name">' + escapeHtml(x.title) + '</span>'
+ '<span class="pl-sub">' + (x.version_label ? escapeHtml(x.version_label) + ' · ' : '') + escapeHtml(how(x)) + '</span></span></a></li>').join('')
+ '</ul></div></div>';
host.hidden = false;
} catch (e) {
// not shown - the article reads the same without it
}
}- It reuses the
pl-*card classes from the Projects card (assets/js/project-links.js), so the two read as one family. -
currentArticle.id !== articleIdguards against a slow answer arriving after the reader has moved to another article. - Nothing at all is drawn when there are no diagrams, and any error is swallowed: the card is a bonus, never a reason the article fails to show.
- The link is to the diagram id the server returned, which is always the current version.
The toolbar buttons in network-mapper/diagram.php now call the menu:
<button class="nm-btn secondary nm-export-btn" id="exportPngBtn" onclick="NM.exportMenu(event, 'png')" ...>
<button class="nm-btn secondary nm-export-btn" id="exportPdfBtn" onclick="NM.exportMenu(event, 'pdf')" ...> function exportMenu(e, kind) {
const run = kind === 'pdf' ? exportPdf : exportPng;
if (!e || !window.NM_FILES || !window.SaveToFiles) { run('download'); return; } // no button to anchor a menu to: just download
e.stopPropagation();
const r = e.currentTarget.getBoundingClientRect();
showCtxMenu(r.left, r.bottom + 4, [
{ label: t('common.documents.download'), act: () => run('download') },
{ label: t('common.save_to_files.title'), act: () => run('files') }
]);
}-
Without the Files module, nothing changes: the button downloads, exactly as before.
window.NM_FILESis set by the page from the module check, so nobody is offered a dialog that would only say "no access". - The menu is the editor's own right-click menu (
showCtxMenu()), placed under the button. No new widget, and it closes the same way as every other menu. -
stopPropagation()stops the document click handler closing the menu in the same click that opened it. - Both labels are existing shared strings (
common.documents.download,common.save_to_files.title), so they match the Documents panel word for word in every language.
network-mapper/diagram.php loads the pieces:
<link rel="stylesheet" href="../assets/css/save-to-files.css?v=1"> <?php /* PNG / PDF -> Save to Files */ ?> <script>window.NM_FILES = <?php echo analystCanAccessModule(connectToDatabase(), (int)$_SESSION['analyst_id'], 'files') ? 'true' : 'false'; ?>;</script> <?php /* exports can go to Files */ ?>
<script src="../assets/js/save-to-files.js?v=3"></script>Before, PNG went out as canvas.toDataURL() on an <a download>, and PDF through doc.save(). Neither gives you the bytes. Both now produce a Blob and hand it to one function:
async function exportPng(mode) {
const result = await captureCanvas();
if (!result) return;
const blob = await new Promise(res => result.canvas.toBlob(res, 'image/png'));
if (!blob) return;
deliverExport(blob, exportFilename('png'), mode, 'network-mapper.toast.png_exported');
} doc.addImage(result.canvas.toDataURL('image/png'), 'PNG', 0, 0, pageW, pageH);
deliverExport(await doc.output('blob'), exportFilename('pdf'), mode, 'network-mapper.toast.pdf_exported');canvas.toBlob() is callback-only, hence the Promise wrapper. It can hand back null (a canvas too large for the browser), which is checked. doc.output('blob') is the shared PDF writer's way to get the finished file without saving it (see PDF writer - Developer Guide).
function deliverExport(blob, name, mode, toastKey) {
if (mode === 'files' && window.SaveToFiles) {
window.SaveToFiles.open({ blob: blob, name: name });
return;
}
// Browser-native download via a one-shot <a download> click
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.download = name;
link.href = url;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
setTimeout(() => URL.revokeObjectURL(url), 10000);
if (window.showToast) showToast(t(toastKey), 'success');
}- One path for both formats, so the download and the save always get the same file and the same name (
exportFilename(): the title and version, slugged). - The download now uses an object URL instead of a data URL. A large diagram at
scale: 2makes a data URL of many megabytes; an object URL is a short pointer. It is revoked after 10 seconds, long enough for the browser to start the download. - No toast on the Files path: the dialog says "Saved as ..." itself.
assets/js/save-to-files.js keeps one dialog for every source. The new kind of call carries the bytes instead of a source and id:
* window.SaveToFiles.open({ source: 'email_attachment' | 'document', id, name, ticket: bool })
* window.SaveToFiles.open({ blob, name }) something the page has just made - a diagram's
* PNG or PDF, a report (export formats only:
* FilesSave::saveExport)The folder list, the filter box, the default folder and the name-clash buttons are all unchanged. Only the send differs:
function sendExport(o, folderId, onConflict) {
var fd = new FormData();
fd.append('source', 'export');
fd.append('name', o.name || 'export');
fd.append('folder_id', String(folderId));
fd.append('on_conflict', onConflict || 'ask');
fd.append('file', o.blob, o.name || 'export');
return fetch(API, { method: 'POST', credentials: 'same-origin', body: fd })
.then(function (r) { return r.json(); })
.then(function (j) { if (!j.success) throw new Error(j.error || 'Error'); return j; });
} (o.blob ? sendExport(o, parseInt(sel.value, 10), onConflict)
: call({ source: o.source, id: o.id, folder_id: parseInt(sel.value, 10), ticket_folder: !!(tick && tick.checked), on_conflict: onConflict || 'ask' }))- Multipart, not JSON, because the body is a file. No
Content-Typeheader is set: the browser must write it, with the multipart boundary. - On a name clash the server answers
{conflict: true, choices, default}and the dialog asks, then callssend(choice)again. With a blob that means the bytes are sent again with the choice; nothing is held on the server between the two requests. A diagram export is small enough that this is simpler than a staged upload. - The answer has the same shape as the other sources (
item_id,name,open_url), so the "Saved as ... Open in Files" line works unchanged. - The "In a folder for this ticket" box only appears for
o.ticket, so an export never sees it. - CSRF:
assets/js/csrf.jsaddsX-CSRF-Tokento thisfetch()like any other same-origin POST, sosendExport()does nothing special.csrfRequireWriteMethod()in the endpoint refuses anything that is not a POST.
csrfRequireWriteMethod();
if (isset($_FILES['file'])) {
// Something the page made in the browser - sent with the request, not held here yet.
$f = $_FILES['file'];
if (($f['error'] ?? UPLOAD_ERR_NO_FILE) !== UPLOAD_ERR_OK || !is_uploaded_file($f['tmp_name'])) filesApiFail('The file did not arrive.');
try {
$r = FilesSave::saveExport($conn, $analystId, $f['tmp_name'], (string)($_POST['name'] ?? $f['name'] ?? ''),
(int)($_POST['folder_id'] ?? 0), (string)($_POST['on_conflict'] ?? 'ask'));
if (!empty($r['item_id'])) $r['open_url'] = BASE_URL . 'files/?item=' . (int)$r['item_id'];
filesApiOk($r);
} catch (ServiceError $e) {
filesApiFail($e->getMessage(), $e->kind === 'forbidden' ? 403 : ($e->kind === 'not_found' ? 404 : 200));
}
}-
is_uploaded_file()proves the path really is PHP's temp file for this request. Without it, any path string reachingsaveExport()could be read off the server's disk and copied into Files. - The endpoint is still a Files endpoint:
includes/files/api_bootstrap.phpsigns the request in and runsrequireModuleAccessJson('files')before anything here. - The error mapping is the same as the existing JSON branch, so the dialog shows the server's sentence either way.
includes/services/files_save.php:
/** Export formats a page may save straight into Files, by extension => what the bytes must start with. */
public const EXPORT_TYPES = [
'png' => "\x89PNG\r\n\x1a\n",
'jpg' => "\xFF\xD8\xFF",
'jpeg' => "\xFF\xD8\xFF",
'pdf' => '%PDF-',
'xlsx' => "PK\x03\x04",
'csv' => '', // text: checked below instead
]; public static function saveExport(PDO $conn, int $analystId, string $localPath, string $name, int $folderId, string $onConflict = 'ask'): array
{
if (!analystCanAccessModule($conn, $analystId, 'files')) throw new ServiceError('forbidden', 'forbidden', 'You do not have access to Files.');
if (FilesAcl::level($conn, $analystId, $folderId) < FilesAcl::UPLOAD) throw new ServiceError('forbidden', 'forbidden', 'You cannot save into that folder - it needs Upload.');
$ext = strtolower(pathinfo($name, PATHINFO_EXTENSION));
$bad = new ServiceError('validation', 'invalid_field', 'Only a PNG, JPEG, PDF, CSV or Excel export can be saved this way.');
if (!array_key_exists($ext, self::EXPORT_TYPES) || !is_file($localPath)) throw $bad;
$head = (string)file_get_contents($localPath, false, null, 0, 4096);
$magic = self::EXPORT_TYPES[$ext];
if ($magic !== '' && strncmp($head, $magic, strlen($magic)) !== 0) throw $bad;
// text, not a binary renamed .csv - the whole file, not just its first 4 KB
if ($ext === 'csv' && ($head === '' || self::fileHas($localPath, ["\0"]) !== [])) throw $bad;
// TRAP: "PK\x03\x04" starts EVERY zip - a .docx, a .jar or any archive. A workbook also names
// [Content_Types].xml and xl/workbook.xml in its entries (stored uncompressed in the zip's headers).
if ($ext === 'xlsx' && count(self::fileHas($localPath, ['[Content_Types].xml', 'xl/workbook.xml'])) !== 2) throw $bad;
return filesStoreLocalFile($conn, $analystId, $folderId, $localPath, $name, $onConflict) + ['folder_id' => $folderId];
}The other two sources copy a file FreeITSM already holds, so the server can check where it came from (the ticket, the document's record). An export arrives from the browser: the server has no record of it and cannot know the page really made it. Without limits this endpoint would be a second Upload, one without the Files page's own screen, its upload rules or its audit wording, and anything (an .html page, an .svg with script, an .exe) could be written into any folder the person can upload to, under any name. So:
-
Only formats a page exports. Images, PDF, CSV and Excel: the things a report or diagram produces. Anything else, including
.html,.svgand.exe, is refused whatever it holds. Real uploads still go through Files. -
The bytes must be what the name says. Each binary format starts with fixed magic bytes. HTML renamed
x.pngfails the PNG check, so a file cannot be smuggled in under an innocent extension and later opened by the viewer as something else. Only the first 4 KB is read, which is plenty for a signature. -
CSV has no signature, so it is checked the other way round: it must not be empty and must not contain a NUL byte, which plain text never does and almost every binary does. That stops an executable renamed
.csv. The NUL check reads the whole file (fileHas(), below) - until 5.11.0 it read only the first 4 KB, so a binary behind 4 KB of commas got through. -
An
.xlsxis a zip, andPK\x03\x04starts every zip - a Word file, a.jar, any archive. So a workbook must also name the two entries every workbook has,[Content_Types].xmlandxl/workbook.xml. Entry names are stored uncompressed in a zip's headers, so they can be found in the bytes without the zip extension:
private static function fileHas(string $path, array $needles): array
{
$found = [];
$keep = max(array_map('strlen', $needles)) - 1;
$fh = fopen($path, 'rb');
if (!$fh) return [];
$tail = '';
while (!feof($fh) && count($found) < count($needles)) {
$chunk = $tail . (string)fread($fh, 1048576);
foreach ($needles as $n) {
if (!in_array($n, $found, true) && strpos($chunk, $n) !== false) $found[] = $n;
}
$tail = $keep > 0 ? substr($chunk, -$keep) : '';
}
fclose($fh);
return $found;
}The chunk overlap ($keep, one byte less than the longest needle) is what finds a name split across two 1 MB reads.
-
After that, it is an ordinary save. The Files module, Upload (
FilesAcl::UPLOAD) on the folder, and thenfilesStoreLocalFile(): the same name cleaning, the same largest-upload limit, Overwrite needing Modify, the Files -> Settings -> Versions choices, the audit row (uploadornew_version) and the storage move queue as a ticket attachment saved into Files. That function and its TRAP are on Save to Files - Developer Guide. - The checks run in order of cost: module, then folder, then extension, then reading bytes. A refused folder never causes a file read.
- One message for every format failure. "Not a format" and "bytes do not match" are the same error, so the endpoint does not tell anyone which check they nearly passed.
Any page that builds a file in the browser can offer the same choice. The server side needs nothing new as long as the format is in EXPORT_TYPES.
In the page's PHP:
<link rel="stylesheet" href="../assets/css/save-to-files.css?v=1">
<script>window.MY_FILES = <?php echo analystCanAccessModule(connectToDatabase(), (int)$_SESSION['analyst_id'], 'files') ? 'true' : 'false'; ?>;</script>
<script src="../assets/js/save-to-files.js?v=3"></script>Where the export used to download:
const blob = new Blob([csvText], { type: 'text/csv' }); // or canvas.toBlob(), or doc.output('blob')
const name = 'asset-register-2026-11-24.csv'; // the extension decides the check
if (window.MY_FILES && window.SaveToFiles) window.SaveToFiles.open({ blob: blob, name: name });
else { /* the existing download */ }That is the whole of it. The dialog lists the folders the person can upload to, handles the name clash, and links to the saved file. Things to know:
-
The extension in
namemust match the bytes. A CSV called.xlsxis refused. An XLSX must be a real workbook (PK\x03\x04, plus[Content_Types].xmlandxl/workbook.xmlamong its entries). -
Offer it only with the Files module, as
exportMenu()does withwindow.NM_FILES. The server refuses anyway; the check just avoids a dead end. -
A new format means a new line in
FilesSave::EXPORT_TYPESwith its magic bytes, the wording of the$badmessage, and a positive and negative check intests/files-save-export.php. Do not add a text format other than CSV without its own text check, and never addhtml,svg,jsor anything a browser would run. -
Load
assets/js/save-to-files.jsat the same?v=as every other page that loads it (see Traps).
- TRAP:
allowedForSave()must run before the save's transaction starts. It reads what is on the diagram now. OncereplaceContents()/replaceShapes()have deleted the rows, "already linked" is empty, and every save by someone who cannot read a colleague's article silently strips that link. BothcreateDiagram()andsaveDiagram()compute$articlesbeforebeginTransaction(). - TRAP: every title must come from
readable(). Do not add aJOIN knowledge_articlestoapi/network-mapper/get_diagram.phpor anywhere else to "save a query". The title is the one thing that must not reach someone Knowledge would not show the article to. - TRAP: an empty
titlesmust encode as{}.api/network-mapper/get_diagram.phpswaps innew stdClass(), andloadDiagram()checks!Array.isArray(). An empty PHP array is[]in JSON, and[]with numeric keys set on it later behaves differently. - TRAP:
GET articles.php?article_id=sits aboverequireModuleAccessJson('network-mapper')on purpose. The Knowledge reader calls it for people who may not have Network Mapper; they must get{success: true, diagrams: []}, not a 403. Do not move the module check up. - TRAP:
knowledgeVisibilitySql()'s default lifecycle islive. Every call inincludes/services/network_articles.phppasses one on purpose:anyfor links that already exist (readableRows()),unarchivedfor the picker (search()). A new call that leaves it out brings back the 5.10 bug where a linked draft or archived article read "An article you don't have access to" - even to its author. - TRAP: the related list writes straight away; item links wait for Save. They look alike on screen. An item link set and then abandoned with "leave without saving" is lost; a related article is not.
- TRAP: the book's
mousedownmust stop propagation. Without it, clicking the book selects the node and starts a drag. The.is-exportingrule keeps the book out of PNG and PDF exports; a new decoration on items needs the same rule. - TRAP:
assets/js/save-to-files.jsis loaded once per page:if (window.SaveToFiles) return;. The Documents panel (includes/documents_panel.php) andtickets/index.phpload it too. If one page loads two different?v=values, whichever loads first wins, andv=2has noblobsupport. When the file changes, bump every?v=together (grep forassets/js/save-to-files.js?v=). - TRAP: the export branch of
api/files/save_from.phpis chosen by the presence of$_FILES['file'], not by thesource=exportfield, which the server does not read. A multipart POST with a file always goes tosaveExport(). - TRAP:
filesStoreLocalFile()writes a Files item the wayapi/files/upload.php's finish step does (bytes, rows,queueIfMoved, keep-N / overwrite). This is the existing TRAP inincludes/services/files_save.php; exports go through it too, so a change to either path is a change to three callers now. - TRAP: on a name clash the blob is sent twice. The first request asks; the choice resends the whole file. Fine for a diagram; a page that exports something very large should keep that in mind (the largest-upload limit in Files -> Settings applies to each request).
Both are CLI scripts that refuse to run over the web, need FREEITSM_TEST_DATABASE set to the database the install's config.php uses (they skip otherwise), and clean up after themselves in finally.
FREEITSM_TEST_DATABASE=<throwaway db> FREEITSM_TEST_URL=http://localhost/<that install> php tests/network-mapper-articles.php
FREEITSM_TEST_DATABASE=<throwaway db> FREEITSM_TEST_URL=http://localhost/<that install> php tests/files-save-export.php
It works as an ordinary analyst (not an administrator) who has both Knowledge and Network Mapper and does not hold Cap::KNOWLEDGE_MANAGE, because a Knowledge manager passes the administrator floor and would see everything, proving nothing. It skips if no such analyst exists. It makes two ZZ articles, one open and one Restricted with no grants, and a ZZ diagram.
Who can read what
- POSITIVE CONTROL:
readable()returns the open article with its title. Without this, the next check could pass because nothing is readable at all. - ...but not the Restricted one.
-
search('ZZ ')offers the open article and not the Restricted one. - A draft and an archived article are readable, with their titles and states (
readableRows()), not "no access". - ...while a Restricted draft is still not readable: the lifecycle is lifted, not the permission.
- The picker offers the draft (state
draft) but not the archived article, and the open one aslive.
Related articles
7. The analyst can addRelated() the open article; adding the Restricted one throws, and the related list is just the open one.
8. After a colleague's row for the Restricted article is put straight into network_diagram_articles, forDiagram() for the analyst has both ids in titles, the Restricted one with null.
9. ...and the analyst may still removeRelated() it.
10. A linked draft and a linked archived article come back from forDiagram() with their titles and states, and a published one has no state.
11. ...and the draft lists the diagram back on its own page (diagramsForArticle()).
Links on shapes and nodes
12. A save by the analyst with two shapes keeps the open article's link and drops the Restricted id typed into the request.
13. After a colleague links the Restricted article to that shape (direct UPDATE), the analyst's next save keeps it.
14. A node keeps its article through saveDiagram() (when the database has a CMDB object to use).
Versions and the way back
15. createVersion() copies the related list.
16. ...and every shape's and node's article_id.
17. diagramsForArticle() for the open article lists only the new current version, not the old one.
18. ...and for the Restricted article lists nothing to the analyst who cannot read it.
19. addRelated() on the old version throws (historical, read-only).
When the article goes
20. Deleting the Restricted article removes its network_diagram_articles rows (CASCADE) and sets article_id to NULL on the shapes in both versions (SET NULL); the shapes themselves stay.
Then cleaned up: no ZZ % article rows left.
It makes a top-level ZZ folder with its own permissions (Full for the administrator only, inherit_permissions = 0) and calls FilesSave::saveExport() directly. Skips if Files is off.
- POSITIVE CONTROL: a real 1x1 PNG is saved, with the name it was given.
- ...and a PDF (
%PDF-1.4). - ...and a CSV.
- Saving the same PNG name again answers
conflictwithchoices, exactly as an upload does. - HTML with a
<script>renamed.pngis refused. - A PDF renamed
.pngis refused: the bytes must match the name, not just be some allowed format. - A format that is not an export (
.html,.svg,.exe) is refused even when it holds valid PNG bytes. - A binary (an
MZheader with NULs) renamed.csvis refused. - ...even when the binary part starts after 4 KB of CSV text (the whole file is checked).
- POSITIVE CONTROL: a workbook (a real zip from
ZipArchivewhen the extension is there) saves as.xlsx. - A Word file renamed
.xlsxis refused - it startsPKlike every zip. - ...and so is any other zip.
- A folder that does not exist is refused.
Then cleaned up: the stored bytes deleted from the active store, the version, item, permission and folder rows removed, and the temp files unlinked.
No automated test covers the browser half (the menu, toBlob(), the dialog opening with the blob); check it by hand after changing exportMenu(), deliverExport() or assets/js/save-to-files.js.
See also: Network Mapper - Developer Guide Β· Network Mapper - Shapes and Layers - Developer Guide Β· Network Mapper - Icon Libraries - Developer Guide Β· Network Mapper Β· Save to Files - Developer Guide Β· Files - Developer Guide Β· Knowledge folders and security - Developer Guide Β· CSRF Protection - Developer Guide Β· PDF writer - Developer Guide Β· Developer Tests: Knowledge Β· Analysts Leaving
FreeITSM β an open-source IT Service Management platform Β· github.com/edmozley/freeitsm Β· MIT licence
- Installation
- β° Scheduled tasks (cron jobs)
-
Architecture
- β³ π§Ή Root folder tidy (URL routing)
- β³ π Database Integrity (FKs & constraints)
- β³ π οΈ Database Verification β Developer Guide
- β³ π§© Service Layer (UI + API share code)
- β³ πͺ€ Code traps (the TRAP: comments)
- β³ π Commenting for the Engineering wiki
- β³ π οΈ Engineering wiki scanner - Developer Guide
- β³ π Service-Layer progress
- π€ Contributing (read before a pull request)
- π§ͺ Developer tests
- π PDF exports moved to PDFKit (#254)
- AI Providers
- Internationalisation (i18n)
- Timezones & Time Handling
- π Date & Time Formats
- π± Currencies
- π§ The sidebar (optional module rail)
- π§© Preference templates
- π Display order (modules, Watchtower cards) β Developer Guide
- Theming & Dark Mode
- ποΈ Recent β getting back to what you were doing
- β¨οΈ Command palette (βK)
- π Searching inside tickets
- π Attached documents
-
MobileβFriendly
- β³ π« Mobile: Tickets
- β³ π» Mobile: Assets
- β³ π Mobile: Calendar
- β³ π Mobile: Knowledge
- β³ π¦ Mobile: Service Status
- β³ πΌ Mobile: Watchtower
- β³ π§© Mobile: Problem Management
- β³ π Mobile: Change Management
- β³ πΏ Mobile: Software
- β³ β Mobile: Tasks
- β³ π Mobile: Forms
- β³ π Mobile: Contracts
- β³ π Mobile: Domains
- β³ π Mobile: People
- β³ π Mobile: Projects
- β³ ποΈ Mobile: Files
- β³ π Mobile: LMS
- β³ πΊοΈ Mobile: CMDB
- β³ πΊοΈ Mobile: Network Mapper
- β³ π§ Mobile: Process Mapper
- β³ βοΈ Mobile: Workflow
- β³ π₯οΈ Mobile: System
- β³ π Mobile: Reporting
- β³ π Mobile: System Wiki
- β³ π Mobile: Self-Service Portal
- β³ π§° Mobile: Techniques & Tricks
-
Security
- Layer 1 β which modules you can enter
- β³ π§© Module Access Control
- β³ π οΈ Module Access β Developer Guide
- β³ π Switching modules off
- β³ π οΈ Module availability β Developer Guide
- β³ π Module availability β design (#217)
- Layer 2 β what you can administer
- β³ π Roles & Permissions
- β³ π οΈ Roles β Developer Guide
- β³ π€ Why capabilities are constants
- Layer 3 β the System module
- β³ π Admin Access Control
- Hardening
- β³ π Security review response 2026-08
- β³ π‘οΈ Security hardening 2026-08
- β³ π οΈ Security hardening 2026-08 β Developer Guide
- β³ π‘οΈ Round three β plain English
- β³ π οΈ Round three β Developer Guide
- β³ π‘οΈ CSRF protection (S4) β Developer Guide
- Single Sign-On (SSO)
- ποΈ LDAP & Active Directory
-
π¦ Microsoft Entra ID
- β³ π₯ Importing people and groups
- β³ π» Intune: assets to their primary user
- β³ π’ Organisation chart
- β³ π οΈ Entra directory sync β Developer Guide
- β³ π οΈ Entra import - review (#235)
- β³ π οΈ Entra follow-ups - review (#237-#240)
- β³ π οΈ Intune primary user - review (#236)
- β³ π οΈ Intune after an Entra import - review (#334)
- β³ π οΈ Intune primary user history - review (#338)
- β³ π οΈ Intune asset types - review (#339)
- β³ π οΈ Intune scheduled syncs - review (#344)
- β³ π οΈ Microsoft 365 in Integrations - review (#352)
- β³ π οΈ Organisation chart - reviews (#242, #265)
- π CardDAV contact sync
- Browser Extension
- API Reference
-
π REST API β how it works
- β³ π Script library (PowerShell + Python)
- β³ π Proposal: custom fields, inventory import and change evidence (#194)
- β³ π οΈ Custom fields, evidence + inventory - review (#195-#197)
- β³ π οΈ Long forms in a task's Work view - review (#198)
- β³ π οΈ Empty Procedures fold - review (#247)
- β³ π« REST API: Tickets
- β³ π» REST API: Assets
- β³ π΄ REST API: Problems
- β³ π REST API: Changes
- β³ π REST API: Knowledge
- β³ β REST API: Tasks
- β³ ποΈ REST API: CMDB
- β³ π REST API: Contracts
- β³ ποΈ REST API: Calendar
- β³ πΏ REST API: Software
- β³ π REST API: Domains
- β³ π¦ REST API: Service Status
- β³ βοΈ REST API: Morning Checks
- β³ π REST API: Forms
- β³ βοΈ REST API: Workflow
- β³ π·οΈ REST API: Cost centres
- β³ π’ REST API: Companies
- β³ π REST API: Chart of accounts
- β³ π REST API: Projects
- β³ π‘οΈ API threat protection
- β³ π§βπΌ REST API: Analysts
- β³ πΊοΈ REST API: Network Mapper
- β³ π§ Using the API docs page
- β³ π OpenAPI specification
- β³ β OpenAPI: kept correct
- β³ π οΈ Maintaining the catalogue
- Watchtower
-
Tickets
- β³ Reply subject and replying to one message
- β³ π Live updates
- β³ π οΈ Watching a ticket - Developer Guide (1 of 2)
- β³ βοΈ Ticket address suggestions - Developer Guide
- β³ π οΈ CSAT delay and reminder - Developer Guide
- β³ π οΈ Ticket checklist step types - Developer Guide (1 of 2)
- β³ π οΈ Right-click Attach checklist - Developer Guide
- β³ π οΈ Checklists in the REST API - Developer Guide
- β³ π A ticket's related block and attachments - Developer Guide
- β³ π οΈ Inbox.js map β Developer Guide
- β³ π οΈ Floating windows & the file viewer β Developer Guide
- β³ π οΈ Tickets settings β Developer Guide
- β³ π Simpler ticket and task forms - design (#218)
- β³ ποΈ The ticket workspace
- β³ π Forms on tickets
- β³ π The ticket table
- β³ π Rota copy and paste β Developer Deep Dive
- β³ β Checklists & SOPs
- β³ βοΈ Mandatory fields
- β³ π§Ύ Custom ticket fields
- β³ π·οΈ Ticket categories
- β³ π§Ύ A type for every new ticket
- β³ π₯ Assigning tickets to a team, and escalation
- β³ π’ One board across every company
- β³ π Many companies: searchable lists (#358)
- β³ π Ticket dashboard β Developer Guide
- β³ Mailbox Authentication
- β³ π€ Email send log
- β³ βοΈ Emailed reports
- β³ π Attachment size limits and large emails
-
β³ Basic IMAP mailboxes
- β³ π Basic IMAP without the PHP extension (#257)
- β³ π οΈ Basic IMAP client β Developer Guide
- β³ π§ͺ Basic IMAP client β Testing and verifying
- β³ π οΈ Basic IMAP - Sent copy - Developer Guide (#270)
- β³ π€ PR #400 Sending through a relay without a login
- β³ π οΈ Verifying a mail folder β Developer Guide
- β³ π οΈ Mailbox providers β Developer Guide
- β³ π οΈ How Gmail mail collection works β Developer Guide
- β³ Email rendering & images
- β³ SLA Management
- β³ WhatsApp channel
-
β³
βοΈ Telegram channel - β³ β CSAT company scope and filters β Developer Guide
- β³ π₯ Microsoft Teams channel
- β³ π¨οΈ Mattermost channel
- β³ π¬ Web chat channel
- β³ π£ Slack channel
- β³ π Linking tickets
- β³ β Record previews
- β³ π Ticket notes: internal or shared
- β³ ποΈ Canned responses
- β³ βοΈ Limiting replies to particular senders
- β³ π¨ Telling the analyst a ticket is theirs
- β³ βοΈ Email signatures
- β³ π The public web address
- β³ π’ Ticket numbering
- β³ π Raising a ticket for someone else
- β³ π Merging tickets
- β³ π Confidential tickets
- β³ π₯ Portal managers
- β³ π Who has seen a ticket
- β³ π Reading long tickets
- β³ β¨ Reply Cleanup prompt and history
- β³ β Splitting tickets
- β³ β Selecting several tickets
- β³ ποΈ The folder pane
- β³ π½ Just my tickets, or no closed ones
- β³ π οΈ Snoozing tickets β Developer Guide
- β³ π₯ Collision detection
- β³ β±οΈ Time tracking
- β³ π Case reports - a ticket and its work as one PDF
- β³ π Scheduled work in your own calendar
- Problem Management
-
Tasks
- β³ π οΈ Task ID and hover card - review (#405)
- β³ π οΈ Task ID, Company column and hover card β Developer Guide
- β³ π οΈ Task board and subtasks β Developer Guide
- β³ π§βπ€βπ§ People on a task ("Involved")
- β³ π Repeating tasks
- β³ π Complete history for tasks and tickets - design (#430)
- β³ π’ Moving a task between companies
- π Projects
-
Assets
- β³ π οΈ Asset list by type - review (#340)
- β³ π’ Moving an asset between companies
- β³ π Shared asset locations
- β³ π§βπΌ Assigning assets to analysts
- β³ π Warranty and lease alerts
- β³ π Leases
- β³ π Saved table views
- β³ π¨οΈ Recording anything, and importing it
- β³ π§© Asset type layouts
- β³ π Inventory freshness
- β³ π Linked configuration item
- β³ π Connected assets
- β³ π Asset review
- β³ π Missing information
- β³ π¦ Consumables
-
β³ π·οΈ QR asset labels
- β³ π οΈ QR asset labels β Developer Guide
- β³ π Asset label designer - design (#229)
- β³ π· Asset scanning β Developer Guide
- β³ π οΈ Asset tag numbering β Developer Guide
- β³ π οΈ Asset reconciliation β Developer Guide
- β³ π οΈ Reconciliation, tags + labels - review (#164)
- β³ π Who holds what, and handover documents
- β³ π₯οΈ The inventory agent (PowerShell)
- β³ ποΈ Proxmox VE servers
- β³ βοΈ VMware Cloud Director servers
- β³ πͺ Hyper-V and Failover Clusters
- β³ π Linking equipment to tickets
- β³ βοΈ Follow-up tasks on a ticket
- Knowledge
- Change Management
- Calendar
- Morning Checks
- Reporting
- Software
-
Forms
- β³ π¨ The form designer β Developer Guide
- β³ π Layout & the grid β Developer Guide
- β³ ποΈ Collections β grouping submissions
- β³ π Submissions as PDFs
- β³ β‘ What happens next β a form's own actions
- β³ π οΈ Sections & conditional logic β Developer Guide
- β³ π οΈ Lookup fields β Developer Guide
- β³ π οΈ Calculated totals β Developer Guide
-
β³ π‘οΈ Catalogue request approvals
- β³ π οΈ Catalogue approvals β Developer Guide
- β³ π οΈ Approval steps and chains β Developer Guide
- β³ π οΈ Portal approvals β Developer Guide
- β³ π οΈ Approvers change a request's answers β Developer Guide
- β³ π Catalogue group approvals β design (#220)
- β³ π Catalogue as a shop β design (#348)
- β³ π Financial approvals - design (#160)
- People
- Starters & leavers
- Domains
-
ποΈ Files
-
β³ π οΈ Files - Developer Guide
- β³ Versions
- β³ Save to Files
- β³ Storage: server folder or S3
- β³ π S3 storage - PR review
- β³ ποΈ Recycle bin
- β³ π Thumbnails and gallery - design (#424)
- β³ π Recycle bin - design
- β³ π Recycle bin - PR review
- β³ π Deleting or moving a folder
- β³ π Storage series - follow-ups
- β³ π οΈ Floating windows & the file viewer β Developer Guide
-
β³ π οΈ Files - Developer Guide
- Contracts
- Service Status
- π Notifications
- π¨ War Room
-
Self-Service Portal
- β³ π¨ Branding the portal
- β³ π What people can do
- β³ π Help Centre
- β³ πͺ Landing page
- β³ π¨ Login screen designer
- β³ π οΈ Back to your page after sign-in - review (#407)
- β³ π οΈ Back to your page after sign-in β Developer Guide
- β³ π Request catalogue
- β³ π Portal privacy
- β³ π₯ Portal managers
- β³ π Contact details
- β³ π οΈ Developer guide
- LMS
- Process Mapper
-
CMDB
- β³ π§± Designing your CMDB
- β³ π οΈ CMDB β Developer Guide
- β³ π οΈ Impact analysis β Developer Guide
- β³ π οΈ Data quality β Developer Guide
- β³ π οΈ Record references β Developer Guide
- β³ π οΈ CMDB assistant - Developer Guide
- β³ π Linked assets
- β³ π Linking an asset to its CI - design (#201)
- β³ π Discovery and redundancy-aware impact - design (#199)
- β³ π οΈ Relationship wording - review (#297)
- Network Mapper
-
Workflows
- β³ π Branches: If / Otherwise and Choose by value
- β³ π οΈ Workflow engine β Developer Guide
- β³ π οΈ Workflows for tasks β Developer Guide
- β³ π οΈ Workflow notes on a ticket β Developer Guide
- β³ π οΈ Workflow category routing β Developer Guide
- β³ π Workflows in order, child tickets - design (#304)
- β³ β° Time-Based Triggers
- β³ πͺ Webhooks
- β³ π¬ Webhook Message Formats
- β³ π HTTPS Certificates & CA Bundles
- β³ π οΈ SSL Verification β the Global Setting
- β³ π Workflow & Webhook Pitfalls
- Issue trackers (Jira, Azure DevOps)
- π‘ Zabbix (monitoring)
- π¬ Microsoft Teams alerts
- π 3CX (phone system)
-
System
- β³ π οΈ System cards by topic - review (#347)
- β³ π¦ Microsoft 365 (Entra ID and Intune)
- β³ π οΈ Preferences β Developer Guide
- β³ ποΈ Settings on one page
- β³ π§Ή Maintenance
- β³ πΎ Storage usage
- β³ βοΈ Emailed reports
- β³ π Finding people in the Analysts list
- β³ πͺ When an analyst leaves
- β³ π οΈ System β Branding β Developer Guide
- β³ π©Ί Page health (D019) β Developer Guide
- β³ β Feature Bingo
- β³ π Locations
- β³ π·οΈ Cost centres
- β³ π Chart of accounts
- β³ π· Photo Album
- β³ Demo Data
- β³ π οΈ Demo Data β Developer Guide
-
Overview
- β³ π Progress tracker
- β³ Concepts & vocabulary
- β³ Email routing & mailboxes
- β³ Settings: global vs per-company
- β³ Users & self-service
- β³ Staff cross-company access
- β³ One company supporting another
- β³ π’ One board across every company
- β³ Worked examples
- β³ Pitfalls & gotchas
- β³ Scope: what it's for
- β³ π οΈ Developer Guide (make a module multi-company)
- β³ ποΈ Case study: CMDB (a linked graph)
- β³ π§ͺ Test harness (prove it's isolated)
- What this is
-
π Bugs resolved
- β³ π» #436 Intune Last seen not updating
- β³ π #429 Trust duration ignored
- β³ π #423 Knowledge PDF lost formatting
- β³ π§Ύ #427 SOP checklist picker always empty
- β³ π #425 Label beside left a wide gap
- β³ π #422 Calendar Open in inbox link
- β³ π #420 Lookup answers unusable after submit
- β³ π #413 Reading pane too narrow on tablets
- β³ π± #412 Sign-in card cramped on phones
- β³ π§ #411 Header buttons out of reach
- β³ π± #386 Project stuck in an old currency
- β³ π₯οΈ #393 Header ran off the screen
- β³ π±οΈ #395 Ticket flyouts ran off the bottom
- β³ π PR #401 Change editor used hardcoded priorities
- β³ π Knowledge drafts could not be published
- β³ π§© #392 Project dialogs shared element ids
- β³ πΌοΈ #391 Knowledge images from your computer
- β³ π #375 REST API wall-clock times
- β³ π #374 Calendar popup ran off the screen
- β³ π’ #373 All companies: Changes, CMDB, Starters
- β³ π’ #356 Assets People and All companies
- β³ π #366 LMS demo data would not import
- β³ π #362/#365 Team handover showed only a name
- β³ π #365 The bell credited the wrong person
- β³ ποΈ #369 Inbox empty until Database Verification
- β³ πͺ #360 Links opened inside the ticket
- β³ π #354 Workspace Links missed tasks
- β³ π Two access fixes (5.9.1)
- β³ π Task company checks in the API (5.5.0)
- β³ π Asset holders through the API (5.4.0)
- β³ π Files folder delete did not check inside (5.4.0)
- β³ π The Intune tab did not check the company
- β³ π #332 Files viewer would not open
- β³ π #333 Note attachments downloaded
- β³ πͺ #326/#327 Form webhook Full record
- β³ π #325 Form PDF download failed
- β³ π Small fixes in 5.1.0
- β³ π CMDB relationships read backwards (5.1.0)
- β³ π #301 CSAT delay was never applied
- β³ π #281 Comments imported from Jira never arrived
- β³ π #288 A change failed to open with Enforce approvals on
- β³ π Long non-Latin articles never got an embedding
- β³ π« #280 Email lookups scanned the whole table
- β³ β #266 Dragging a task told nobody
- β³ π #255 Article previews showed HTML codes
- β³ π #252 A link to a Knowledge article did not open
- β³ π #254 PDFs could not print Polish
- β³ π #250 Clicking a folder left the open article on screen
- β³ π« #260 The dashboard cog did nothing
- β³ π« #248 A department rule never matched on four routes
- β³ π A directory account could be matched to someone else
- β³ π« #244 Reply went to the assigned analyst
- β³ π Mailbox sign-in was not checked
- β³ π Four weaknesses around signing in
- β³ π A lookup answer could name any record
- β³ π« #227 A mailbox could not be deleted
- β³ π« #226 A picture on a note could not be closed
- β³ π» #222 The Assets page never loaded in 4.3.0
- β³ βοΈ #214 A "contains" condition did not match capitals
- β³ βοΈ #216 A workflow email from a chosen mailbox always failed
- β³ π³ The Docker image was missing PHP extensions
- β³ π A failed DNS lookup read as a missing record
- β³ π A link could change data
- β³ π Access outlived its removal
- β³ π Knowledge articles could run scripts
- β³ π Knowledge writes ignored permissions
- β³ π Company boundaries (Oct 2026)
- β³ π Smaller gaps (Oct 2026)
- β³ π Escaped text could leave its attribute
- β³ π Task descriptions were not cleaned
- β³ π Task documents ignored company scope
- β³ π Repeating tasks ignored company scope
- β³ π¬ #183 Mailbox checks overlapped
- β³ π #188 Transfer lock shown off when unknown
- β³ β #184 Subtask names and Overdue
- β³ π§© #186 Teams: the buttons did nothing
- β³ π Text in a change could run script
- β³ π AI settings changed without the AI permission
- β³ πͺ #178 Deleting an analyst failed
- β³ π« A team with no departments showed 0 tickets
- β³ π Projects: adding a phase did nothing on Save
- β³ π Leavers could still sign in
- β³ πΌοΈ Logo and courses broke on Apache with PHP-FPM
- β³ π’ Chat tickets ignored your ticket numbering
- β³ π Dates shown as a dash, or in server time
- β³ π Assets β Users showed people from other companies
- β³ π Restricted analysts could read other modules' data
- β³ πΌοΈ Replies with a picture in the thread failed to send
- β³ π Reply attachments never reached the customer
- β³ π οΈ Outbound email attachments β Developer Guide
- β³ π A global SSO provider was missing from the portal
- β³ π Behind a proxy, the SSO redirect said http
- β³ βοΈ The portal tagline moved when you saved it
- β³ π¨ The portal settings screen forgot what you saved
- β³ π‘οΈ The approvals inbox said "Error" and nothing else
- β³ π A table's answers were missing from the PDF
- β³ β A single-select column let you tick every option
- β³ π The portal ignored a form's field widths
- β³ π The tasks board stopped taking clicks
- β³ ποΈ #121 The index list is out of date after upgrading
- β³ π #133 The calendar subscription was empty
- β³ π #131 Tasks always reopened on the board
- β³ π₯ #129 Every page returned HTTP 500 after upgrading
- β³ π³ #127 A PHP warning above the System page
- β³ π #126 Notes stamped with the server's clock
- β³ π Storing every date in UTC
- β³ πͺ The portal was down for everyone signed in
- β³ βοΈ #120 Workflow notes could never be written
- β³ βοΈ #123 Three errors when running Database Verification
- β³ π #122 The description box was a stub in the corner
- β³ π£ Demo data deleted real accounts
- β³ π #117 Sign-in redirected to the wrong address
- β³ π¨ #108 The priority dot was invisible
- β³ β±οΈ #116 Time logged from the right-click menu
- β³ π #114 API keys refused by our own guard
- β³ ποΈ #110 Assigning a task told nobody
- β³ πͺ #107 Signed out while still working
- β³ π #103 "Share with Requester" reached nobody
- β³ π #102 Search found nothing for hyphens
- β³ πͺ #101 Source code editor opened behind
- β³ βοΈ #88 Subtasks could not be ticked off
- β³ π» #84 Asset deep link selected nothing
- β³ π« #79 A new ticket arrived with no status
- β³ π§ #79 A ticket from email did not say so
- β³ π #78 Bell opened to nothing
- β³ π¬ #77 Mail only collected from Inbox
- β³ π #74 The default password could not be changed
- β³ π¦ #70 Renaming an impact level
- β³ π€ #67 App-only mailboxes could not send
- β³ π #45 Verify only ever worked for Microsoft
- β³ π #45 IMAP reported as not authenticated
- β³ βοΈ An email template stopped escaping itself
- β³ π The portal dashboard showed the wrong time
- β³ π’ The folder said 99 and the list showed 96