<div dir="ltr">Hi dear devs good day<div><br></div><div>I'm developing a specific app for geonode where I need an alternate layer model, I've used the original layer model as example, in general it works fine, but the problem is when I want to retrieve the resource via geoserver API REST.<div><br></div><div>It is only available for the admin user or superuser, but not for any other user or anonymous, </div><div>could you help me??? how can I assign perms for this new model, I think this is the trouble.</div><div><br></div><div>Notes:</div><div>I create the Layer from a Postgis view and upload to geoserver with the next code:</div><div><br></div><div><pre style="color:rgb(0,0,0);font-family:"dejavu sans mono";font-size:9pt">cat = Catalog(settings.OGC_SERVER[<span style="color:rgb(0,128,0);font-weight:bold">'default'</span>][<span style="color:rgb(0,128,0);font-weight:bold">'LOCATION'</span>] + <span style="color:rgb(0,128,0);font-weight:bold">"rest"</span>,<br>              _user, _password)<br>workspace = cat.get_workspace(settings.DEFAULT_WORKSPACE)<br>ds_list = cat.get_xml(workspace.datastore_url)<br>datastores = [datastore_from_index(cat, workspace, n) <span style="color:rgb(0,0,128);font-weight:bold">for </span>n <span style="color:rgb(0,0,128);font-weight:bold">in </span>ds_list.findall(<span style="color:rgb(0,128,0);font-weight:bold">"dataStore"</span>)]<br>ds = <span style="background-color:rgb(228,228,255)">None</span><br><span style="color:rgb(0,0,128);font-weight:bold">for </span>datastore <span style="color:rgb(0,0,128);font-weight:bold">in </span>datastores:<br>    <span style="color:rgb(0,0,128);font-weight:bold">if </span><a href="http://datastore.name">datastore.name</a> == <span style="color:rgb(0,128,0);font-weight:bold">"datastore"</span>:<br>        ds = datastore<br>ft = cat.publish_featuretype(view_name, ds, mun_layer.srid, <span style="color:rgb(102,0,153)">srs</span>=mun_layer.srid)<br>ft.title = layer_title<br>cat.save(ft)</pre><pre style="color:rgb(0,0,0);font-family:"dejavu sans mono";font-size:9pt"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;white-space:normal"><br></span></pre><pre style="color:rgb(0,0,0);font-family:"dejavu sans mono";font-size:9pt"><span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;white-space:normal">I create the Layer in Django like this:</span><br></pre><pre style="color:rgb(0,0,0);font-family:"dejavu sans mono";font-size:9pt"><pre style="font-family:"dejavu sans mono";font-size:9pt">signals.pre_save.disconnect(geoserver_pre_save, <span style="color:rgb(102,0,153)">sender</span>=AlfLayer) #Not sure about this line implementation<br>layer, created = AlfLayer.objects.get_or_create(<span style="color:rgb(102,0,153)">name</span>=view_name, <span style="color:rgb(102,0,153)">alf_table</span>=alf_table, <span style="color:rgb(102,0,153)">defaults</span>={<br>    <span style="color:rgb(0,128,0);font-weight:bold">"workspace"</span>: <a href="http://workspace.name">workspace.name</a>,<br>    <span style="color:rgb(0,128,0);font-weight:bold">"store"</span>: <a href="http://ds.name">ds.name</a>,<br>    <span style="color:rgb(0,128,0);font-weight:bold">"storeType"</span>: ds.resource_type,<br>    <span style="color:rgb(0,128,0);font-weight:bold">"typename"</span>: <span style="color:rgb(0,128,0);font-weight:bold">"%s:%s" </span>% (workspace.name.encode(<span style="color:rgb(0,128,0);font-weight:bold">'utf-8'</span>), ft.name.encode(<span style="color:rgb(0,128,0);font-weight:bold">'utf-8'</span>)),<br>    <span style="color:rgb(0,128,0);font-weight:bold">"title"</span>: ft.title <span style="color:rgb(0,0,128);font-weight:bold">or </span><span style="color:rgb(0,128,0);font-weight:bold">'No title provided'</span>,<br>    <span style="color:rgb(0,128,0);font-weight:bold">"uuid"</span>: <span style="color:rgb(0,0,128)">str</span>(uuid.uuid4()),<br>    <span style="color:rgb(0,128,0);font-weight:bold">"bbox_x0"</span>: Decimal(ft.latlon_bbox[<span style="color:rgb(0,0,255)">0</span>]),<br>    <span style="color:rgb(0,128,0);font-weight:bold">"bbox_x1"</span>: Decimal(ft.latlon_bbox[<span style="color:rgb(0,0,255)">1</span>]),<br>    <span style="color:rgb(0,128,0);font-weight:bold">"bbox_y0"</span>: Decimal(ft.latlon_bbox[<span style="color:rgb(0,0,255)">2</span>]),<br>    <span style="color:rgb(0,128,0);font-weight:bold">"bbox_y1"</span>: Decimal(ft.latlon_bbox[<span style="color:rgb(0,0,255)">3</span>])<br>})<br>signals.pre_save.connect(geoserver_pre_save, <span style="color:rgb(102,0,153)">sender</span>=AlfLayer)<br><span style="color:rgb(128,128,128);font-style:italic"><br></span><span style="color:rgb(128,128,128);font-style:italic"><br></span>perm_spec = {<br>    <span style="color:rgb(0,128,0);font-weight:bold">"users"</span>: {<span style="color:rgb(128,128,128);font-style:italic"><br></span><span style="color:rgb(128,128,128);font-style:italic">        </span><span style="color:rgb(0,128,0);font-weight:bold">"AnonymousUser"</span>: [<span style="color:rgb(0,128,0);font-weight:bold">"view_resourcebase"</span>]<br>    },<br>    <span style="color:rgb(0,128,0);font-weight:bold">"groups"</span>: {<span style="color:rgb(0,128,0);font-weight:bold">"anonymous"</span>: [<span style="color:rgb(0,128,0);font-weight:bold">"view_resourcebase"</span>]}<br>}<br><br>layer.set_permissions(perm_spec)</pre><pre style="font-family:"dejavu sans mono";font-size:9pt"><br></pre><pre style="font-family:"dejavu sans mono";font-size:9pt">Any help is appreciated, in advance so many thanks.</pre></pre></div></div></div>