I’m working on a plugin to manage information in a targeted manner in the geoserver repository.
For this, I need to use an api. I saw that rest would be the api candidate.
The idea is to login to geoserver (which have connected to an LDAP authentication service).
Then I can check the list of layers, using the CSW protocol, choose one or more authorized layers for reference (recovered by WMS and / or WFS) and editing a small group of polygons (to avoid a general locking of the layer), and finally, save the changes using WFST. I’m thinking to work in a checking/checkout process.
I started with the OpenGeo plugin, to learn about the rest api.
My FIRST QUESTION is whether rest is the right api to work on my project.
the first problem appeared to me, it is that the login by this plugin, is via an internal user. and I did not need to authenticate through ldap.
I worked in a small script in python to understand the operation, using gsconfig.
the script was finished working for me:
Catalog import from geoserver.catalog
ip = “myhost”
cat = Catalog ( “http: //” + ip + “: 8080 / geoserver /”, “myldapuser”, “myldappass”)
cat.set_base_url ( “http: //” + ip + “: 8080 / geoserver / rest /”)
for l in cat.get_layers ():
print l.name
I had to modify catalog.py in gsconfig adding “set_base_url” because, on the one hand, the login should do in /geoserver/ and api operations in /geoserver/rest.
I do not know if this is correct, and it’s my SECOND QUESTION. The modification was to add to catalog.py, the following:
def set_base_url(self, service_url):
self.service_url = service_url
Finally, the last part of the code (below get_layers function), did not work.
To make it work, I had to change the file rest.properties:
/ **; GET = ADMIN
/ **, POST, DELETE, PUT = ADMIN
/ **; GET = IS_AUTHENTICATED_ANONYMOUSLY
/ **; POST, DELETE, PUT = IS_AUTHENTICATED_ANONYMOUSLY
With this change, I remove the restriction that only the internal user admin can work with the repository.
Obviously, if I do not authentic (in my case, with ldap), I can’t do nothing.
The THIRD QUESTION is validate if this change is appropriate to maintain a repository that can only be managed through the authentication and authorization to geoserver layers.
Obviously, I have more questions, but these are very important for me to determine if I’m on the right track.
TIA
jorge infante
rosario - santa fe - argentina