Skip to content

Commit cf68bc5

Browse files
authored
Merge pull request #69 from line-o/feat/allow-publish-via-curl
Allow package publishing with basic auth
2 parents c5278d2 + 301d1f3 commit cf68bc5

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

modules/publish-package.xq

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ declare function local:log-put-package-event($filename as xs:string) as empty-se
3131
log:event($event)
3232
};
3333

34-
declare function local:upload-and-publish($xar-filename as xs:string, $xar-binary as xs:base64Binary) {
34+
declare function local:upload-and-publish($xar-filename as xs:string, $xar-binary as xs:base64Binary) as map(*) {
3535
let $path := scanrepo:store($config:packages-col, $xar-filename, $xar-binary)
3636
let $publish := scanrepo:publish-package($xar-filename)
3737
return
@@ -48,7 +48,12 @@ declare function local:upload-and-publish($xar-filename as xs:string, $xar-binar
4848

4949
let $xar-filename := request:get-uploaded-file-name("files[]")
5050
let $xar-binary := request:get-uploaded-file-data("files[]")
51-
let $user := request:get-attribute($config:login-domain || ".user")
51+
let $user :=
52+
(
53+
request:get-attribute($config:login-domain || ".user"),
54+
sm:id()//sm:username/string()
55+
)[1]
56+
5257
let $required-group := config:repo-permissions()?group
5358
return
5459
if (exists($user) and sm:get-user-groups($user) = $required-group) then

0 commit comments

Comments
 (0)