When using geofence extension, creating a new layergroup crashes UI
Description
Environment
Activity
Andrea Aime February 15, 2017 at 11:48 AM
Mass closing all resolved issues not modified in the last 4 weeks
Andrea Aime March 7, 2016 at 6:44 PM
Fix backported to 2.8.x and 2.7.x too
Niels Charlier January 29, 2016 at 10:45 AM
I fixed the cloning, however further issues persist with having a SecuredLayerInfo inside an (inner) LayerGroupInfoImpl. GoefenceManager gets incredibly confused. Unlike what you said, there is no support for having this construction anywhere in the code.
Interesting, if you look at the SecuredLayerInfo implementation, you will see that the setResource method is overwritten to ensure exactly that there is only an unwrapped (and not a secured) ResourceInfo inside the inner LayerInfoImpl. This proves again that there is no support for these kind of constructions and people have previously yet implemented a strategy to prevent this from happening. However, they forgot to do this with SecuredLayerGroupInfo.
I am going to have to follow the same strategy, and rewrite SecuredLayerGroupInfo to make sure that
(1) the layers remain in sync between the wrapper and the inner object
(2) the layers inside the inner object are always unwrapped
Furthermore, I will need to make sure that the SecureCatalog always wraps layergroups, including new layergroups, so that the unwrapping mechanism always happens.
Niels Charlier January 29, 2016 at 9:13 AM
Correction, the UI does not unwrap. It is only with new layergroups that they are not secured (yet).
I now also found other buggy behaviour, when you open and edit an existing layergroup, you are working the securedlayergroupinfo.
As a consequence, the layers are now added to the securedlayergroupinfo's layer collection but NOT the inner layergroupimpl. Which means it is actually forgotten and not stored at all.
Giant bug :O
This only happens when geofence is part of your build.
When you add a new layergroup, the layer group list page crashes each time until you restart Geoserver (see stacktrace below).
The bug seems to be caused by a SecureLayerInfoImpl being added to the LayerGroupInfoImpl instead of the unwrapped LayerInfoImpl.