<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi,<br>
<br>
I'm writing to explain the solution we have found to update
geonetwork privileges with command lines. We didn't try to implement
Geonetwork API because it seemed too difficult. We work directly in
geonetwork database. I know it's not perfect but it's works!<br>
<br>
First, we get the uuid of metedata we are looking for. This
information is in the table metadata.<br>
SELECT id FROM metadata WHERE data ILIKE
'%fouilles_chailluz__pt_limsit_sra%';<br>
=> metadataid 277223<br>
<br>
Secondly, we look the table operationallowed and we can see
operations allowed for each metadata (we know what numbers mean with
the table operations).<br>
SELECT * FROM operationallowed WHERE metadataid = 277223 ;<br>
=> 1;277223;0<br>
It means that this metadata (277223) can be read (0) by everybody
(1). Sometimes, this line doesn't exist. We want to update metatada
privileges to allow everybody to download the metadata XML file and
see the link to the viewer. We need to insert the two following
lines :<br>
INSERT INTO operationallowed VALUES (1,277223,1) ;<br>
INSERT INTO operationallowed VALUES (1,277223,5) ;<br>
<br>
We can join the step of searching the uuid and the step of updating
the operationallowed table :<br>
INSERT INTO operationallowed SELECT 1, metadata.id, 1 FROM metadata
WHERE data ILIKE '%fouilles_chailluz__pt_limsit_sra%';<br>
<br>
<u>So, to translate these operations in our python script, we do :</u><br>
sql_req = "set schema 'geonetwork'; INSERT INTO operationallowed
SELECT 1, metadata.id, 1 FROM metadata WHERE data ILIKE '%" +
name_layer_gs + "%' ; INSERT INTO operationallowed SELECT 1,
metadata.id, 5 FROM metadata WHERE data ILIKE '%" + name_layer_gs +
"%' ; INSERT INTO operationallowed SELECT 1, metadata.id, 0 FROM
metadata WHERE data ILIKE '%" + name_layer_gs + "%' AND NOT EXISTS
(SELECT * FROM operationallowed JOIN metadata ON
operationallowed.metadataid = metadata.id WHERE data ILIKE '%" +
name_layer_gs + "%' AND operationid = 0) ; "<br>
sql_file_name = tmpdir + "/update_privilege.sql"<br>
sql_file = open(sql_file_name,"w")<br>
sql_file.write(sql_req)<br>
sql_file.close()<br>
os.system("psql -h localhost -d georchestra -U geosync -a -f " +
sql_file_name)<br>
<br>
Hope this helps.<br>
<br>
Sophie.<br>
<i><br>
Sophie MOLLARD</i>
<br>
<div class="moz-signature"><br>
<i>Pôle Géomatique</i><br>
<i><a href="http://mshe.univ-fcomte.fr">MSHE C. N. Ledoux (USR
3124)</a></i><br>
<i>Université de Franche-Comté</i><br>
<i>Tél : 03.81.66.51.55</i><br>
<br>
</div>
<div class="moz-cite-prefix">Le 14/11/2016 à 13:10, Tom Kralidis a
écrit :<br>
</div>
<blockquote
cite="mid:alpine.DEB.2.11.1611140704390.2358@www.localdomain"
type="cite">
<br>
Hi Sophie:
<br>
<br>
On Mon, 14 Nov 2016, Sophie Mollard wrote:
<br>
<br>
<blockquote type="cite">Date: Mon, 14 Nov 2016 12:36:06 +0100
<br>
From: Sophie Mollard <a class="moz-txt-link-rfc2396E" href="mailto:sophie.mollard@mshe.univ-fcomte.fr"><sophie.mollard@mshe.univ-fcomte.fr></a>
<br>
To: <a class="moz-txt-link-rfc2396E" href="mailto:owslib-users@lists.osgeo.org">"owslib-users@lists.osgeo.org"</a>
<a class="moz-txt-link-rfc2396E" href="mailto:owslib-users@lists.osgeo.org"><owslib-users@lists.osgeo.org></a>
<br>
Subject: [OWSLib-users] Update metadata privileges with OWSlib
<br>
<br>
Hi all,
<br>
<br>
I'm working with Geonetwork 3 and I'm using CSW protocol to
insert metadata via OWSlib and an administrator user.
<br>
In GeoNetwork admin console, I checked "Inserted metadata is
public". It works : everybody can read the metadata but I need
to go further. I would like that everybody can also see data
linked to metadata in the viewer and download the metadata (even
anonymous). How
<br>
can I do that ?
<br>
Can I update metadata privileges with OWSlib ? Or, can I change
default privileges somewhere into Geonetwork ? Have you another
idea ?
<br>
<br>
</blockquote>
<br>
CSW by nature does not address permissions or access control, and
as a result
<br>
privileges are left to the implementation and out of scope for
OWSLib.
<br>
<br>
Your best bet is to implement additional functionality against the
GeoNetwork
<br>
API to set permissions after a given CSW-T Insert.
<br>
<br>
Hope this helps.
<br>
<br>
..Tom
<br>
<br>
<blockquote type="cite">Thank you in advance,
<br>
<br>
--
<br>
Sophie MOLLARD
<br>
</blockquote>
</blockquote>
<br>
</body>
</html>