def set_geofence_all(instance):
 resource = instance.get_self_resource()
 if hasattr(resource, 'layer'):
  try:
   '\n            curl -X POST -u admin:geoserver -H "Content-Type: text/xml" -d             "<Rule><workspace>geonode</workspace><layer>{layer}</layer><access>ALLOW</access></Rule>"             http://<host>:<port>/geoserver/geofence/rest/rules\n            '
   url = settings.OGC_SERVER['default']['PUBLIC_LOCATION']
   user = settings.OGC_SERVER['default']['USER']
   passwd = settings.OGC_SERVER['default']['PASSWORD']
   headers = {'Content-type': 'application/xml'}
   payload = '<Rule><workspace>geonode</workspace><layer>'
   payload = (payload + resource.layer.name)
   payload = (payload + '</layer><access>ALLOW</access></Rule>')
   r = requests.post((url + 'geofence/rest/rules'), headers=headers, data=payload, auth=HTTPBasicAuth(user, passwd))
   if (r.status_code != 200):
    logger.warning(('Could not ADD GeoServer ANONYMOUS Rule for Layer ' + str(resource.layer.name)))
  except:
   tb = traceback.format_exc()
   logger.debug(tb)

def set_geofence_all ( instance ) : resource = instance . get_self_resource ( ) if hasattr ( resource , 'layer' ) : try : url = settings . OGC_SERVER [ 'default' ] [ 'PUBLIC_LOCATION' ] user = settings . OGC_SERVER [ 'default' ] [ 'USER' ] passwd = settings . OGC_SERVER [ 'default' ] [ 'PASSWORD' ] headers = { 'Content-type' : 'application/xml' } payload = '<Rule><workspace>geonode</workspace><layer>' payload = ( payload + resource . layer . name ) payload = ( payload + '</layer><access>ALLOW</access></Rule>' ) r = requests . post ( ( url + 'geofence/rest/rules' ) , headers = headers , data = payload , auth = HTTPBasicAuth ( user , passwd ) ) if ( r . status_code != 200 ) : logger . warning ( ( 'Could not ADD GeoServer ANONYMOUS Rule for Layer ' + str ( resource . layer . name ) ) ) except : tb = traceback . format_exc ( ) logger . debug ( tb )
assign access permissions to all users .