Hi Carlo,
I can confirm that all PUT operations in the whole GeoServer API have been
operating like PATCH since day one (around 2007?),
the ACL one is no exception. There is no way to fully overwrite any
resource like a PUT would do.
To achieve what you want you'd first have to delete everything and then
start over.... to be honest I don't see an easy way to do that.

Maybe modify the controller method for PUT to have a new "replace" mode as
a query parameter?
Currently it just seems to be trying to locate existing rules that match
and update them,  which means, it would preserve the order of the rules as
they were in the file, rather than the one you provided.

Also about the ordering... are you using JSON or XML? Remember that JSON is
not order preserving, a representation
like this one has no order by definition (a JSON object is "an unordered
collection of zero or more name/value pairs"):

{
  "/**:GET":"ADMIN",
 "/**:POST,DELETE,PUT":"ADMIN"
}

while this one does have order instead (by XML definition):

<rules>
<rule resource="/**:GET">ADMIN</rule>
<rule resource="/**:POST,DELETE,PUT">ADMIN</rule>
</rules>

The default JSON representation of this resource really does not make sense
for this use case, should be a list.... using Map in the backend is not a
good fit for this case.

Cheers
Andrea

On Tue, Oct 24, 2023 at 11:07 PM carlo cancellieri <
geo.ccancelli...@gmail.com> wrote:

> Dear List,
>  looking for a REST api to update the rest.properties file I'm using the
> features provided by:
> https://github.com/geoserver/geoserver/wiki/GSIP-120
>
> Unfortunately it seems that it's still affected by the ordering problem.
> I see it should be solved here
> https://osgeo-org.atlassian.net/browse/GEOS-5139
> but I'm testing the main branch now and every time a post is performed the
> order of the file is messed up and all the settings (in terms of rule
> ordering) are lost.
>
> In addition to that it's not possible to operate with a real PUT operation
> replacing all the rules, it looks like it has been implemented more like a
> PATCH where only existing rules can be updated with a PUT.
>
> I've a branch with some ideas which is trying to address all the problems
> with minimum changes but I'm still confused about this rest api, and I
> don't want to go too far if this is not an issue....
>
> I'd love to have the confirmation that this is still an open issue or I'm
> doing something wrong.
>
> Thank you all.
>
> Best,
> Carlo
>
> --
> Carlo Cancellieri
> *Skype*: ccancellieri
> *Twitter*: @cancellieric
> *LinkedIn*: http://it.linkedin.com/in/ccancellieri/
> _______________________________________________
> Geoserver-devel mailing list
> Geoserver-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-devel
>


-- 

Regards,

Andrea Aime

==
GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions Group
phone: +39 0584 962313

fax:     +39 0584 1660272

mob:   +39  339 8844549

https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it

-------------------------------------------------------

Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE
2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si
precisa che ogni circostanza inerente alla presente email (il suo
contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è
riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il
messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra
operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is
addressed and may contain information that is privileged, confidential or
otherwise protected from disclosure. We remind that - as provided by
European Regulation 2016/679 “GDPR” - copying, dissemination or use of this
e-mail or the information herein by anyone other than the intended
recipient is prohibited. If you have received this email by mistake, please
notify us immediately by telephone or e-mail
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to