Skip to content

Commit

Permalink
- geoserver proxy style check fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessio Fabiani committed Nov 14, 2018
1 parent 69ee087 commit b27a1f9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
23 changes: 13 additions & 10 deletions geonode/geoserver/views.py
Expand Up @@ -419,16 +419,19 @@ def style_change_check(request, path):
# and check if the user has change_style_layer permissions on each
# of them
style_name = os.path.splitext(request.path)[0].split('/')[-1]
try:
style = Style.objects.get(name=style_name)
for layer in style.layer_styles.all():
if not request.user.has_perm(
'change_layer_style', obj=layer):
authorized = False
except BaseException:
authorized = False
logger.warn(
'There is not a style with such a name: %s.' % style_name)
if style_name == 'styles' and 'raw' in request.GET:
authorized = True
else:
try:
style = Style.objects.get(name=style_name)
for layer in style.layer_styles.all():
if not request.user.has_perm(
'change_layer_style', obj=layer):
authorized = False
except BaseException:
authorized = False
logger.warn(
'There is not a style with such a name: %s.' % style_name)
return authorized


Expand Down
5 changes: 4 additions & 1 deletion geonode/upload/upload.py
Expand Up @@ -39,6 +39,7 @@
import shutil
import uuid
import zipfile
import traceback

from django.conf import settings
from django.db.models import Max
Expand Down Expand Up @@ -397,7 +398,9 @@ def save_step(user, layer, spatial_files, overwrite=True, mosaic=False,
# @todo once the random tmp9723481758915 type of name is not
# around, need to track the name computed above, for now, the
# target store name can be used
except Exception as e:
except BaseException as e:
tb = traceback.format_exc()
logger.debug(tb)
logger.exception('Error creating import session')
raise e

Expand Down

0 comments on commit b27a1f9

Please sign in to comment.