file:name -> admin permission required

Friday, 1 September 2017 · 3 messages
GD
Günter Dunz-Wolff1 Sep 2017 14:10 #

Hi all,

I updated my older basex-version, now I get in my RESTXQ-App the error 'admin permission required‘ with

let $collection := collection("data/stories")
for $doc in $collection
    let $file_name := file:name($doc)
    return $file_name

Whats going wrong?

Thanks for any help. Guenter

FE
Fabrice ETANCHAUD1 Sep 2017 14:28 #

Hi Guenter,

Your file:name() usage is a bit borrowed (outside the file module standard usage), Could it be because file module usage is restricted in a webapp context for security reasons ?

Is the document serialization leading to a file path ? It seems you are giving a document-node to the file:name function, did you try file:name(db:path($doc)) ?

Usually I just use something like tokenize(db:path($doc), '/')[last()]

Best regards, Fabrice

-----Message d'origine-----

Quoted text · Günter Dunz-Wolff · 12 lines
De : basex-talk-bounces at mailman.uni-konstanz.de [mailto:basex-talk-bounces at mailman.uni-konstanz.de] De la part de Günter Dunz-Wolff Envoyé : vendredi 1 septembre 2017 14:11 À : BaseX Objet : [basex-talk] file:name -> admin permission required Hi all, I updated my older basex-version, now I get in my RESTXQ-App the error 'admin permission required‘ with let $collection := collection("data/stories") for $doc in $collection let $file_name := file:name($doc) return $file_name Whats going wrong? Thanks for any help. Guenter
GD
Günter Dunz-Wolff1 Sep 2017 15:33 #

Hi Fabrice, thanks for your advice. The solution with tokenize(db:path($doc), '/')[last()] is working. Best regards, Guenter

Quoted text · Fabrice ETANCHAUD · 36 lines
> Am 01.09.2017 um 14:28 schrieb Fabrice ETANCHAUD <fetanchaud at pch.cerfrance.fr>: > > Hi Guenter, > > Your file:name() usage is a bit borrowed (outside the file module standard usage), > Could it be because file module usage is restricted in a webapp context for security reasons ? > > Is the document serialization leading to a file path ? > It seems you are giving a document-node to the file:name function, did you try file:name(db:path($doc)) ? > > > Usually I just use something like tokenize(db:path($doc), '/')[last()] > > Best regards, > Fabrice > > > -----Message d'origine----- > De : basex-talk-bounces at mailman.uni-konstanz.de [mailto:basex-talk-bounces at mailman.uni-konstanz.de] De la part de Günter Dunz-Wolff > Envoyé : vendredi 1 septembre 2017 14:11 > À : BaseX > Objet : [basex-talk] file:name -> admin permission required > > Hi all, > > I updated my older basex-version, now I get in my RESTXQ-App the error 'admin permission required‘ with > > let $collection := collection("data/stories") for $doc in $collection > let $file_name := file:name($doc) > return $file_name > > Whats going wrong? > > Thanks for any help. > Guenter >

⚡Generated with XQuery