Store which user triggered the creation of a snapshot by pressing the Node-RED deploy button.
Description
We capture the user's ID when a user has created a snapshot via the FlowFuse interface but not when the snapshot is created due to a user pressing the Deploy button in Node-RED. For audit log purposes it would be useful to know who triggered the creation of a given snapshot.
Which customers would this be available to
Team + Enterprise Tiers (EE)
Have you provided an initial effort estimate for this issue?
I have provided an initial effort estimate
### Tasks
- [ ] https://github.com/FlowFuse/flowfuse/issues/4529
- [ ] Capture who initiated auto-snapshot for a device
This was requested by - https://app-eu1.hubspot.com/contacts/26586079/record/0-1/5854019565
For context I believe this will require Node-RED changes to pass it with the flow on deploy
This is also relevant/in-support of https://github.com/FlowFuse/flowfuse/issues/4424
Proposal:
We can update the nr-launcher to pass the userid back to the storage api. (Node-RED does pass the user object, it's just not in the docs...)
From there we can add a column to the StorageFlows table to store the last user to update the flow (if present)
Then when the audit log event triggers the auto snapshot we can check the StorageFlows table and use the UserId if present.
After some discussion and discovery, I have found we already have the means to log the user whose action initiated the auto-snapshot. In short, the flows.set audit event already contains the users hash. By looking up the user we can use that for the meta.user in the auto snapshot call
I will raise a PR that may actually negate FlowFuse/nr-launcher#287
UPDATE
PR raised: https://github.com/FlowFuse/flowfuse/pull/4530
Re task "Capture who initiated auto-snapshot for a device"
This one is more tricky. The user is not passed to a device (like an instance is)...
Instance:
Device:
@Steve-Mcl this is done for cloud instances now isn't it?
Just the question of the device instance?
@Steve-Mcl this is done for cloud instances now isn't it?
Yup
Just the question of the device instance?
Yup :)
(The task list on this issue is up to date)
@knolleary can we get a status check on this please?