sitmun / sitmun-viewer-app

A basic map viewer application for the SITMUN platform.
European Union Public License 1.2
1 stars 1 forks source link

When a branch breaks, a tree falls down #56

Open RicardCots opened 2 months ago

RicardCots commented 2 months ago

Describe the bug When the SITMUN viewer tries to load a tree containing one or more layers for which that user or territory does not have permission, and which are part of a node where no other layer has permission, the tree is not loaded in the viewer.

In other words, if the tree you are trying to open contains any node with layers without permissions for this user, the tree will not be loaded.

To Reproduce Steps to reproduce the behavior:

  1. Go to SITMUn administrator - tree and configure a new folder with one or more layers, being sure that those layers have no permission for that aplication/territory it's going to be used.
  2. Open the related Viewer.
  3. See how it does not load the layer and throws a generic error (see atached image)

Expected behavior Se espera el mismo comportamiento que en SITMUN 2. Si en un arbol hay una o varias capas definidas para las que un usuario no dispone de permisos de acceso, se cargan todas las capas excepto esas. Independientemente de si hay un o varias capas sin permisos.

Screenshots First add a folder and a layer in the tree. Be sure the layer has not permissions for the user / aplication 7 territory. image

See the error image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

daniboube commented 3 weeks ago

Fixed on commit 0333c219f7535bb2bd8d0c69c6f7d229e1d4825f

Now, when one or more layers of the tree are not accessible for any reason, the app no ​​longer displays any type of error message; it simply removes those layers from the tree and proceeds to load the viewer.

fjlopez commented 3 weeks ago

@RicardCots @mvinent @silmeUsil0001 please review this solution. IMHO, quiet removal of layers is a bad idea. It make impossible to users to realize a bad configuration and notify to SITMUN administrators of the issue.

Layers may be removed, but not silently as the commit implies!

daniboube commented 3 weeks ago

I thought that no type of error should appear. If you want, I can add back the little toast message that appeared when loading an application in case a layer couldn't be loaded.

fjlopez commented 3 weeks ago

Note that several layers may have problems (not only one). Also, I recommend to report it in the console log.

RicardCots commented 3 weeks ago

In SITMUN 2 we often use the same tree for different users, and each user only gets the layers he has access to. This is a feature that simplifies the management, since we would otherwise have to generate many, many different trees, one for each role/territory.

So in my opinion the user should not receive any error or information message. On the other hand, it would be interesting for the SITMUN system administrator to know which layers are in the tree but are not loaded, but not for the user. Maybe it would be enough reporting it in de console log.

daniboube commented 3 weeks ago

Commit 5c6c82b8d93b67bf753b4530ed030d866b1bd6ae add console log type messages when one or more layers cannot be accessed, instead of showing the old toast type error messages.