[QGIS-Developer] Conflict resolution while editing, missing API?

Alessandro Pasotti apasotti at gmail.com
Thu Feb 11 01:18:51 PST 2021


Hi,

I'm thinking about how to implement a conflict resolution feature
(there have been some related talks in the issue tracker recently).

Use case: multiple users editing the same feature in the same
datasource (PG but not only PG) the last who saves wins.

For instance:
1. User A starts editing a feature
2. User B starts editing the same feature
3. User B changes the geometry and commit changes
4. User A changes the geometry and commit changes

Changes from User B are silently lost.

I would like User A to be notified that the feature was modified after
she started editing and before she commits the changes.

I know about PG notifications but I was looking at something more generic.

I've what I need to hook into the commitChanges process and block the
commit if I want to but what I really miss is a way to retrieve the
feature's status "before" it was modified in the editing buffer.

The idea is: in beforeCommitChanges I retrieve the feature status from
the backend and compare it with the feature status that User A sees at
1. But this is not currently possible because:

a. layer.getFeature() sees the feature as modified in the editing buffer
b. layer.dataProvider().getFeature() sees the feature as it is in the
backend storage
c. buffer.changedGeometries() does not have the information about the
previous status of the geometry.

Am I missing something or we really do miss an API to do what I want to do?

-- 
Alessandro Pasotti
QCooperative:  www.qcooperative.net
ItOpen:   www.itopen.it


More information about the QGIS-Developer mailing list