lizmap-web-client icon indicating copy to clipboard operation
lizmap-web-client copied to clipboard

Form filter - Allow to use a second field for the numeric type

Open mdouchin opened this issue 2 years ago • 4 comments

It was already possible for dates in the previous versions. Now a second field can also be used for the numeric form widget. It is useful when the layer features contain two fields describing a minimum and maximum value of the same property (ex: age, width, depth, etc.)

Funded by Terre de Provence Agglomération https://www.terredeprovence-agglo.com/

Linked to https://github.com/3liz/lizmap-plugin/pull/442

mdouchin avatar Aug 10 '22 13:08 mdouchin

Ouch in cypress

Undefined array key "metadata"\n /srv/lzm/lizmap/modules/lizmap/lib/Server/Server.php\t56

It seems from my fault ...

Gustry avatar Aug 10 '22 14:08 Gustry

Ouch in cypress

Undefined array key "metadata"\n /srv/lzm/lizmap/modules/lizmap/lib/Server/Server.php\t56

It seems from my fault ...

https://github.com/3liz/lizmap-web-client/blob/master/lizmap/modules/lizmap/lib/Server/Server.php#L56

The metadata is empty when it's called.

Gustry avatar Aug 10 '22 15:08 Gustry

Ouch in cypress

Undefined array key "metadata"\n /srv/lzm/lizmap/modules/lizmap/lib/Server/Server.php\t56

It seems from my fault ...

https://github.com/3liz/lizmap-web-client/blob/master/lizmap/modules/lizmap/lib/Server/Server.php#L56

The metadata is empty when it's called.

I will check

mdouchin avatar Aug 10 '22 16:08 mdouchin

It seems we must change a little in 3.6 (then use it here) how the full metadata is build and shared by the Server.php lib.

At present, if you are not logged as an admin, the returned metadata is

{"info":{"version":"3.7.0-pre","date":"2021-07-27"},"dependencies":{"jelix":{"version":"1.8.0-alpha.2","minversion":"1.8.0-alpha.2","maxversion":"1.8.0-alpha.2"}},"qgis_server":{"test":"OK","mime_type":"text\/xml; charset=utf-8"},"qgis_server_info":{"error":"NO_ACCESS"}}

There is a rule here: https://github.com/3liz/lizmap-web-client/blob/master/lizmap/modules/lizmap/lib/Server/Server.php#L157 which explains this response. I think the class Server should not consider if the user is logged or not but always return the full metadata. The controller(s) should do the check:

  • in the admin project page, no worries, no check
  • for the "map page", in the lizMap.classic.php the metadata object is only used for access control (I think but have not checked). If so, no worries, no check
  • for the view/app/metadata (the source of the JSON downloaded by the Lizmap plugin) -> the controller should also check and remove the sensitive data if the user is not an administrator. Before returning the metadata, remove sensitive properties: https://github.com/3liz/lizmap-web-client/blob/master/lizmap/modules/view/controllers/app.classic.php#L32

mdouchin avatar Aug 10 '22 16:08 mdouchin

@rldhont gentle ping

mdouchin avatar Aug 30 '22 09:08 mdouchin

@mdouchin LGTM but a test could be added.

rldhont avatar Aug 31 '22 15:08 rldhont

If it is ok for you, I propose we add JS test after your PR #3073 with a test infrastructure will be merged

mdouchin avatar Sep 05 '22 08:09 mdouchin