def style_change_check(request, path):
 authorized = True
 if (request.method == 'POST'):
  if (not request.user.is_authenticated):
   authorized = False
 if (request.method == 'PUT'):
  if (path == 'rest/layers'):
   authorized = True
  else:
   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:
    authorized = False
    logger.warn(('There is not a style with such a name: %s.' % style_name))
 return authorized

def style_change_check ( request , path ) : authorized = True if ( request . method == 'POST' ) : if ( not request . user . is_authenticated ) : authorized = False if ( request . method == 'PUT' ) : if ( path == 'rest/layers' ) : authorized = True else : 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 : authorized = False logger . warn ( ( 'There is not a style with such a name: %s.' % style_name ) ) return authorized
if the layer has not change_layer_style permission .