Skip to content

Prevent race condition when using edit forms in GUI #11732

@tyler-8

Description

@tyler-8

NetBox version

v3.4.4

Feature type

Change to existing functionality

Proposed functionality

In edit forms for primary models, when confirming/saving your changes, add a new validation check that the last_updated time has not changed from when you first started editing the object.

If the last_updated time is captured at the time the edit form is loaded, and check again when the Save button is clicked, we can check that the timestamp is the same as before, before finally saving the new change. Otherwise, a validation error is raised.

Use case

It's possible for two users to be editing an object in the GUI at the same time and overwrite each other's changes. Here's the scenario:

  1. Bob creates a Site.
  2. Joe clicks “Edit” on that Site and has the Edit Site form open.
  3. Bob also clicks Edit on the same Site and makes some changes, clicks “Save”.
  4. Joe make changes on his Edit Form and clicks save.
  5. Bob’s changes are no longer present, and Joe’s change is - based on outdated data.

Database changes

N/A

External dependencies

N/A

Metadata

Metadata

Assignees

Labels

status: acceptedThis issue has been accepted for implementationtype: featureIntroduction of new functionality to the application

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions