Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #614 from tapuzzo-fsi/dev
Browse files Browse the repository at this point in the history
Allow amps to be updated and not just created
  • Loading branch information
dmcassel committed May 25, 2016
2 parents eaa71ed + 6411f65 commit 5baaaab
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion deploy/lib/xquery/setup.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -4744,7 +4744,25 @@ declare function setup:create-amps($import-config)
if ($existing-amps/sec:amp[sec:namespace = $amp/sec:namespace and
sec:local-name = $amp/sec:local-name and
sec:document-uri = $amp/(sec:doc-uri, sec:document-uri) and
sec:db-name = $amp/sec:db-name]) then ()
sec:db-name = $amp/sec:db-name]) then
(
xdmp:eval(
'import module namespace sec="http://marklogic.com/xdmp/security" at "/MarkLogic/security.xqy";
declare variable $amp external;
declare variable $db := if($amp/sec:db-name = "filesystem") then 0 else xdmp:database($amp/sec:db-name);
sec:amp-set-roles(
$amp/sec:namespace,
$amp/sec:local-name,
$amp/(sec:doc-uri, sec:document-uri)[1],
$db,
$amp/sec:role-name
)',
(xs:QName("amp"), $amp),
<options xmlns="xdmp:eval">
<database>{xdmp:security-database()}</database>
</options>
)
)
else
(
xdmp:eval(
Expand Down

0 comments on commit 5baaaab

Please sign in to comment.