TsgcWSPServer_Dataset › Events › OnBeforeDatasetUpdate
Fires before any client-originated dataset change is applied, for global inspection.
property OnBeforeDatasetUpdate: TsgcWSBeforeDatasetUpdateEvent;
// TsgcWSBeforeDatasetUpdateEvent = procedure(Connection: TsgcWSConnection; const JSON: IsgcObjectJSON; var Handled: Boolean) of object
—
Raised once per incoming dataset envelope — whether it carries an insert, an update or a delete — before the row-level OnBefore/OnAfter record events fire. JSON exposes the full envelope (method, fields, keys). Set Handled to True to shortcut the whole pipeline for this message, or mutate the JSON to adjust the payload before it is processed. Useful for cross-cutting concerns such as authorisation, throttling or conflict detection.
procedure TForm1.oProtocolBeforeDatasetUpdate(Connection: TsgcWSConnection;
const JSON: IsgcObjectJSON; var Handled: Boolean);
begin
if JSON.S['method'] = 'delete' then
Handled := not IsAdmin(Connection);
end;