Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GeoNode tries to retrieve Geofence rules for Geoserver layer even if no rules are assigned to them #8154

Closed
giohappy opened this issue Sep 24, 2021 · 1 comment · Fixed by #8155
Assignees
Labels
major A high priority issue which might affect a lot of people or large parts of the codebase security Pull requests that address a security vulnerability
Milestone

Comments

@giohappy
Copy link
Contributor

Expected Behavior

When updatelayers is executed Geoserver layers that are new to GeoNode are imported in GeoNode.

Actual Behavior

An error is thrown since list_geofence_layer_rules_xml tries to read Geofence rules, which in general do not exist for Geoserver layers.

Steps to Reproduce the Problem

  1. create a new layer new_layer in Geoserver (import data, uplod, whatever)
  2. run python manage.py updatelayers -f new_layer
  3. the follwoing error is raised:
Traceback (most recent call last):
  File "/home/giohappy/dev/ibf/GET-IT/src/geonode/geonode/security/models.py", line 421, in set_permissions
    self.set_dirty_state()
  File "/home/giohappy/dev/ibf/GET-IT/src/geonode/geonode/security/utils.py", line 163, in __exit__
    self._execute_requests()
  File "/home/giohappy/dev/ibf/GET-IT/src/geonode/geonode/security/utils.py", line 169, in _execute_requests
    self.adapter_requests_map[request["name"]](
  File "/home/giohappy/dev/ibf/GET-IT/src/geonode/geonode/security/utils.py", line 75, in purge_rules
    self.set_has_committed_changes()
  File "/home/giohappy/dev/ibf/GET-IT/src/geonode/geonode/security/utils.py", line 72, in set_has_committed_changes
    self.safe_point_rules = self.list_rules(xml=True)
  File "/home/giohappy/dev/ibf/GET-IT/src/geonode/geonode/security/utils.py", line 87, in list_rules
    rules = list_geofence_layer_rules_xml(workspace, layer_name)
  File "/home/giohappy/dev/ibf/GET-IT/src/geonode/geonode/decorators.py", line 57, in wrapper
    return func(*args, **kwargs)
  File "/home/giohappy/dev/ibf/GET-IT/src/geonode/geonode/security/utils.py", line 489, in list_geofence_layer_rules_xml
    if rule.find("layer").text == layer_name:
AttributeError: 'NoneType' object has no attribute 'text'

(.....)

Specifications

@giohappy giohappy added the major A high priority issue which might affect a lot of people or large parts of the codebase label Sep 24, 2021
@giohappy giohappy added this to the 3.2.2 milestone Sep 24, 2021
italogsfernandes added a commit to italogsfernandes/geonode that referenced this issue Sep 24, 2021
…server layer even if no rules are assigned to them
@italogsfernandes
Copy link
Contributor

PR opened: #8155

giohappy pushed a commit that referenced this issue Sep 24, 2021
…layer even if no rules are assigned to them (#8155)
@afabiani afabiani added the security Pull requests that address a security vulnerability label Sep 24, 2021
marthamareal pushed a commit to marthamareal/geonode that referenced this issue Oct 6, 2021
…server layer even if no rules are assigned to them (GeoNode#8155)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major A high priority issue which might affect a lot of people or large parts of the codebase security Pull requests that address a security vulnerability
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants