flowfuse icon indicating copy to clipboard operation
flowfuse copied to clipboard

Store which user triggered the creation of a snapshot by pressing the Node-RED deploy button.

Open robmarcer opened this issue 1 year ago • 6 comments

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

robmarcer avatar Aug 27 '24 16:08 robmarcer

This was requested by - https://app-eu1.hubspot.com/contacts/26586079/record/0-1/5854019565

robmarcer avatar Aug 27 '24 16:08 robmarcer

For context I believe this will require Node-RED changes to pass it with the flow on deploy

hardillb avatar Aug 27 '24 16:08 hardillb

This is also relevant/in-support of https://github.com/FlowFuse/flowfuse/issues/4424

joepavitt avatar Aug 29 '24 13:08 joepavitt

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.

hardillb avatar Sep 19 '24 13:09 hardillb

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

Steve-Mcl avatar Sep 20 '24 18:09 Steve-Mcl

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:

image

Device:

image

Steve-Mcl avatar Sep 20 '24 19:09 Steve-Mcl

@Steve-Mcl this is done for cloud instances now isn't it?

Just the question of the device instance?

hardillb avatar Oct 22 '24 13:10 hardillb

@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)

Steve-Mcl avatar Oct 22 '24 15:10 Steve-Mcl

@knolleary can we get a status check on this please?

joepavitt avatar Dec 16 '24 10:12 joepavitt