<div dir="ltr"><div><div><div><div><div>Hi list,<br><br></div>I have GeoNode 2.6.3, installed from apt, in a Ubuntu machine. Right now i have 108 registered layers, some imported using the web interface, some using the `geonode importlayers` command.<br><br></div>Last week I noticed that some of the layers I was importing using the management command had view permission problems. I realized that the cause was that the GeoFence rules were not being created correctly. <br><br></div>Looking at the messages on the list, I saw that there were some discussions about this issue and that 1) there was a patch for <br>geoserver/helper.py [1] and 2) a new `sync_geofence` management command.<br><br></div>I applied the patch and downloaded the `sync_geofence` command.<br><br></div>Now, every time I run `geonode updatelayers` I end up with a different set of rules in GeoFence. Some times with 106 rules, some times with 209 rules etc. And I can't run `geonode sync_geofence` since I'm getting an error:<br><br>UnboundLocalError: local variable 'perm_spec' referenced before assignment<br><div><div><br></div><div>Any idea how to fix this issue so I don't have to manually create the GeoFence rules? And also, not have `geonode updatelayers` mess up the rules already created?<br><br></div><div>Cheers<br></div><div>Daniel<br></div><div><br>[1] - <a href="https://github.com/GeoNode/geonode/commit/94b3b6abfd1bc856be94eb58f5bf13">https://github.com/GeoNode/geonode/commit/94b3b6abfd1bc856be94eb58f5bf13</a><br></div></div></div>