Commit 4fb53d4a authored by Mathias Goebel's avatar Mathias Goebel 🎠
Browse files

login helper for local builds

parent 8dc0383b
......@@ -37,7 +37,7 @@ let $uris := (doc('/db/sade-projects/textgrid/data/xml/agg/' || $agg)
let $lastMod := $uris ! xmldb:last-modified($f-indexproc:dataPath, . || '.xml')
return
if(not(xmldb:login($collection-uri, config:get('sade.user'), config:get("sade.password"))))
if(not(local:login($collection-uri)))
then error(QName("FONTANE", "INDEXVIEW1"), "unable to authenticate.")
else
if( xmldb:last-modified($collection-uri, $resource) gt max($lastMod) )
......@@ -188,3 +188,9 @@ return
default return
$node
};
declare function local:login($col) {
if(false() = xmldb:login( $col, config:get('sade.user') , config:get("sade.password")))
then (xmldb:login( $col, "admin", ""))
else true()
};
......@@ -54,7 +54,7 @@ let $doc :=
httpclient:get($url, $persist, $request-headers, $options)//DIV[@class="dokuwiki export"]),
$result := if( $export//DIV ) then local:HTML2html($export) else $export,
$result := <div>{local:dokuwikiparser( $result/*[not(@id='dw__toc')] )}</div>,
$login := xmldb:login( '/sade-projects/textgrid/data/xml/doku/', config:get('sade.user') , config:get("sade.password")),
$login := local:login(),
$store := xmldb:store( '/sade-projects/textgrid/data/xml/doku/', $id || '.rev' || $revisionInWiki || '.xml' , $result ),
$imageReload := local:dokuwikiImageReload($id, $model)
return
......@@ -109,7 +109,7 @@ let $test :=
if( $lastRevinDb != $lastRevinWiki )
then
(
xmldb:login( '/sade-projects/textgrid/data/xml/doku/', config:get('sade.user'), config:get("sade.password")),
local:login(),
xmldb:remove('/sade-projects/textgrid/data/xml/doku/', $id || '.rev' || string($lastRevinDb) || '.xml' )
)
else ()
......@@ -421,8 +421,14 @@ return
let $last-modified := xs:string($result[1]//http:header[@name="last-modified"]/@value)
let $cache-control := xs:string($result[1]//http:header[@name="cache-control"]/@value)
let $image := xs:base64Binary($result[2])
let $login:= xmldb:login( '/sade-projects/textgrid/data/xml/doku/', config:get('sade.user') , config:get("sade.password"))
let $login:= local:login()
let $store := if( file:exists($path || $id)) then () else file:serialize-binary($image, $path || $id)
return
()
};
declare function local:login() {
if(false() = xmldb:login( '/sade-projects/textgrid/data/xml/doku/', config:get('sade.user') , config:get("sade.password")))
then (xmldb:login('/sade-projects/textgrid/data/xml/doku/', "admin", ""))
else true()
};
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment