Some hints to make an updateable view editable, partly in german:

  * create a table [schema].gt_pk_metadata
  * configure in geoserver datastore [schema].gt_pk_metadata as Primary
    key metadata table
  * add in [schema].gt_pk_metadata a primary key column and pk_sequence:

    |INSERT INTO myschema.gt_pk_metadata(table_schema, table_name,
    pk_column, pk_column_idx, pk_policy, pk_sequence)
    VALUES ('|||myschema|', 'layername', 'id', null, 'sequence',
    'myschema.layername_id_seq')|

  * der Layer unter Datensicherheit Schreibrechte für die Rolle aufweisen
  * die Rolle als Servicezugriffsregeln WFS-T-Rechte aufweisen
  * Wird eines davon erst nach Laden des Layers in QGIS geändert, sollte
    die Geoserver-Konfiguration, der FeatureType und der Layer in QGIS
    neu geladen werden.
  * Wenn der WFS-Layer auf einem SQL-View in Geoserver basiert, ist er
    read-only.


Stefan

Am 04.02.2021 um 06:55 schrieb Michael Steigemann via Geoserver-users:
> Good Morning!
>
> From the documentation
> https://docs.geoserver.org/stable/en/user/data/database/sqlview.html
> <https://docs.geoserver.org/stable/en/user/data/database/sqlview.html>
> it is obvious that a layer based on a SQL-View is read only.
>
> Therefore I created an editable view directly in Postgres and
> registered it as a normal layer in Geoserver. Unfortunately I still
> get the following error message:
>
> 2021-02-04 06:43:50,104 ERROR [geoserver.ows] -
> org.geoserver.wfs.WFSTransactionException:
> {mist}update_my_media_objects is read-only
> at org.geoserver.wfs.Transaction.execute(Transaction.java:241)
> at org.geoserver.wfs.Transaction.transaction(Transaction.java:93)
> at
> org.geoserver.wfs.DefaultWebFeatureService.transaction(DefaultWebFeatureService.java:147)
>
> Is there any workaround? I want to achieve that a user can only edit
> his own records in GeoServer. Therefore I filter  in the view for the
> logged in user:
>
> create or replace view update_my_media_objects as select * from
> media_objects where owner_uid = current_setting('current.user', TRUE);
>
> Thanks and all the best,
> Michael
>
>
> _______________________________________________
> Geoserver-users mailing list
>
> Please make sure you read the following two resources before posting to this 
> list:
> - Earning your support instead of buying it, but Ian Turton: 
> http://www.ianturton.com/talks/foss4g.html#/
> - The GeoServer user list posting guidelines: 
> http://geoserver.org/comm/userlist-guidelines.html
>
> If you want to request a feature or an improvement, also see this: 
> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
>
>
> Geoserver-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users


-- 
Dipl. Ing. Stefan Overkamp
Laakmannsbusch 44, 42555 Velbert 
tel.: 0177 / 79 76 159
overk...@posteo.de

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to