Closed Gpetrak closed 7 hours ago
@Gpetrak the REST API is closed to anonymous users. We might decide to change it in the future, and give access to anonymous for the styles (with a security rule like /rest/workspaces/*/styles/*;GET=IS_AUTHENTICATED_ANONYMOUSLY
), but for the moment I agree we should use the default style and avoid retrieving the style returned by the API.
I don't see why it should break other functionality, since an anonymous user is not able to modify or upload things.
@giohappy thank you for the information. I followed the second approach and the issue was solved. So now, if the user is not authenticated, the plugin loads the layer through WFS without requesting the SLD from GeoNode. In this case, the widget Layer style
and the corresponding buttons in the dialog Layer properties >> GeoNode
are disabled. I pushed these changes in the PR #296 because the changes are related with the execution or not of the SLD request.
When the user tries to load a layer through WFS, the plugin retrieves the SLD from GeoNode in order to display it as in GeoNode. This is a great feature, but when the user is not authenticated (logged in) with the corresponding GeoServer, the plugin asks the user for the GeoServer credentials during the WFS loading process (in order to retrieve the SLD), or it crashes. I think that we have to handle this behavior, either by disabling the WFS button or by loading the layer without the SLD, when the user is not authenticated. The second case needs further investigation because it can break the logic of SLD / layer upload / reload functionalities.