diff --git a/CHANGELOG.md b/CHANGELOG.md index d6cf9fe5a..a89b197e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,18 +6,33 @@ This file documents all notable changes made to ITFlow. ### Upgrading -Update from Maintenance > Update — Queue Update hands the job to cron and it applies on its own. There is no database change in this release, so nothing else is required. +Update from Maintenance > Update — Queue Update hands the job to cron, which updates the files and applies this release's one database change (4.1.1 to 4.1.2) in the same pass. It adds a column to RMM providers for the asset type each kind of device comes in as, and changes nothing that is there. Nothing else is required. + +### New Features & Updates + +- RMM Providers: Link to another asset, in the ⋮ menu on an asset's RMM card, links the device to the asset it really is - when it was matched to the wrong one, or came in as a new asset beside the one you'd entered for it. Pick the asset: it keeps its name and what you've entered, and gets what it's missing from the RMM straight away. Archive, ticked when the RMM made the asset the device had, archives that one, with Undo. Assets another device already has can't be picked. +- RMM Providers: when an asset has nobody assigned and the person signed in to it is one of the client's contacts, its RMM card offers Assign with their name. The username is matched to the contact's email or name - RDG\mwhitfield, marla.whitfield and AzureAD\MarlaWhitfield are all Marla Whitfield - and nothing is offered when no contact matches or more than one could. Bulk Action > Assign Signed-in Users on the assets list does it for every asset ticked that has nobody assigned. +- RMM Providers: a provider's Edit has Asset types - what desktops, laptops, servers and virtual machines come in as, so they can be your own types, such as a Workstation, instead of ITFlow's. Assets whose type the RMM set follow a change at the next sync; one whose type you changed keeps yours. A type of yours that is renamed is renamed here too. +- RMM Providers: a client with devices in an RMM has a card for it on its overview, beside Assets - how many are online, offline and overdue, and how many need a reboot, have patches waiting or have checks failing. Each line opens those devices on the assets list, whose RMM filter now also shows the ones that need a reboot, have patches waiting or have checks failing. Devices overdue are counted under Needs attention too. +- RMM Providers: Bring back is on the client's row on the RMM Clients page as soon as you delete an asset that came from the RMM, rather than after the next sync, and the message for deleting it says so. +- API: assets read through the API come with asset_rmm - each of the asset's devices in an RMM, with its status, when it was last seen, who is signed in, its IPs, and whether it needs a reboot, has patches waiting or has checks failing. ### Bug Fixes - RMM Providers: unlinking a client left its assets showing as still in the RMM - the dot on the assets list, the card on the asset, Take Control and the RMM filter, all with what the RMM said when it was unlinked - and they went on counting as managed devices on recurring invoices. Now they stay as they are but are no longer in the RMM, and each asset's history says its client was unlinked. A client you unlinked before this update is put right at the next sync. Link it again and its devices are matched back to the same assets. -- RMM Providers: reinstalling a device's agent in Tactical - which gives it a new id there - brought it in as a second asset, even with the same serial number and name, and marked the first one as no longer in Tactical. Deleting the extra asset and using Bring back made it again. A reinstalled agent is now matched to the asset its old one had. If you already have an extra asset from this, delete it, click Sync Now, then use Bring back on its client's row on the RMM Clients page. +- RMM Providers: reinstalling a device's agent in Tactical - which gives it a new id there - brought it in as a second asset, even with the same serial number and name, and marked the first one as no longer in Tactical. Deleting the extra asset and using Bring back made it again. A reinstalled agent is now matched to the asset its old one had. If you already have an extra asset from this, open it and use Link to another asset in the ⋮ menu on its RMM card to link the device to the first one - it archives the extra asset. - RMM Providers: a device moved to another linked client in Tactical stayed with its asset at the first client, and that asset took the new client's location. It is now matched or made at the client it moved to. The first client's asset stays there, no longer kept up, and its history says where the device went. Devices that moved before this update are put right at the next sync. ### Developer Updates - `rmmForgetClientDevices($rmm_client_id, $name, $why)` in `functions/rmm.php` deletes an RMM client's `rmm_devices` rows and adds an asset history line for each asset that is still there. Unlinking a client and linking it to another one both use it, and `rmmSync()` runs it for any of the provider's clients with `rmm_client_client_id = 0` that still have rows. - `rmmSync()` marks a client's unlisted devices removed before it saves the listed ones, and `rmmAssetMatch()` no longer counts a removed device as holding its asset, so a reinstalled agent (a new `remote_id`) is matched to the asset its old one had, and the old removed row is deleted. `rmmDeviceSave()` treats a device whose asset belongs to another client as new at this one, leaving that asset with a history line. +- Database 4.1.2: `rmm_providers.rmm_provider_asset_types`, JSON of the type the sync guesses (`Desktop`, `Laptop`, `Server`, `Virtual Machine`) to the asset type to make it - NULL, or a kind it doesn't name, keeps the guessed type. Re-runnable. `rmmProviderAssetTypes($provider)` gives the four, falling back to the guessed type for one that no longer exists, and `rmmDeviceSave()` applies them before matching and following. `rmmProviderCheck()`, `rmmProviderWrite()` and `rmmProviderChangeLines()` take them from the window's `asset_types[...]`, and `assetTypeRenameEverywhere()` calls `rmmProviderAssetTypesRename()`. +- `rmmDeviceLinkAsset($device, $asset_id)` relinks a device by hand: it refuses an asset of another client or one another live device of the provider has, deletes the provider's removed rows on the asset picked, resets `rmm_device_synced` to `[]` so the follow rule only fills what is empty, and writes both assets' history. The `rmm_link_asset` handler in `agent/post/asset.php` then runs `rmmSync()` for the device's RMM client and archives the old asset with `undoArchiveBefore()` when asked. `rmmDeviceById()` and `rmmDeviceLinkTargets()` feed `agent/modals/asset/asset_rmm_link.php`. +- `rmmUserContact($client_id, $logged_user)` matches a signed-in user to exactly one unarchived contact by `rmmUserKey()` - the username after the last backslash and before any @, letters and digits only - against the contact's email local part, full name, first initial and last name, and first name and last initial. Generic accounts such as administrator are never matched. `rmmAssignUserContacts()` uses it through `assetQuickSet()` for the `bulk_rmm_assign_contacts` handler, and the card's Assign posts `rmm_assign_contact`. +- `rmmClientSummary($client_id)` counts a client's unarchived assets with a live device by state, cached per request, for the client overview card and the Devices overdue item in `clientOverviewAttention()`. `agent/assets.php` has `rmm=reboot`, `rmm=patches` and `rmm=checks`. +- `rmmAssetsDeleted($asset_ids)` sets `rmm_device_asset_id = 0` for deleted assets - single, bulk and API delete - so Bring back counts them at once. +- `api/v1/assets/read.php` sets `$api_asset_rmm`, and `api/v1/read_output.php` adds `asset_rmm` through `rmmApiAttach()`. It picks device columns only - never the provider's key or secret. ## [26.12] diff --git a/admin/database_updates/4.1.2.php b/admin/database_updates/4.1.2.php new file mode 100644 index 000000000..d28e1d5fc --- /dev/null +++ b/admin/database_updates/4.1.2.php @@ -0,0 +1,23 @@ + the asset type to make it. + * NULL, or a kind it doesn't name, keeps the guessed type. + * + * Re-runnable: it only adds the column where it isn't. + */ + +defined('FROM_DB_UPDATER') || die("Direct file access is not allowed"); + + $itflow_column = mysqli_query($mysqli, "SELECT 1 FROM information_schema.COLUMNS + WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'rmm_providers' AND COLUMN_NAME = 'rmm_provider_asset_types' LIMIT 1"); + + if ($itflow_column && mysqli_num_rows($itflow_column) === 0) { + mysqli_query($mysqli, "ALTER TABLE `rmm_providers` ADD `rmm_provider_asset_types` varchar(1000) DEFAULT NULL AFTER `rmm_provider_alerts_note`"); + } diff --git a/admin/modals/rmm/rmm_provider_edit.php b/admin/modals/rmm/rmm_provider_edit.php index 23ecc0cc5..c83776843 100644 --- a/admin/modals/rmm/rmm_provider_edit.php +++ b/admin/modals/rmm/rmm_provider_edit.php @@ -5,7 +5,8 @@ * picked when it is added and stays; each kind brings its own fields (rmmProviderKinds() in * functions/rmm.php) - addresses, a key, a secret. A key or secret is never put back into the * page, so left empty it stays. A kind that has alerts can have them open tickets, from the - * level picked, in a category. Save asks first (check_rmm_provider, admin/post/rmm.php): what + * level picked, in a category. Desktops, laptops, servers and virtual machines each come in as + * the asset type picked for them (rmmProviderAssetTypes()). Save asks first (check_rmm_provider, admin/post/rmm.php): what * is wrong shows beside each field and the window stays open; once all is right it saves, and * tries the connection. */ @@ -150,6 +151,31 @@ ob_start(); + +