From dd3c1480c3885e5c291fac9a12eb94efdace49f9 Mon Sep 17 00:00:00 2001 From: Tony Apuzzo Date: Tue, 24 May 2016 19:31:56 -0400 Subject: [PATCH 1/2] Allow amps to be updated and not just created (previously existing amp definitions were not changed by bootstrap). --- deploy/lib/xquery/setup.xqy | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/deploy/lib/xquery/setup.xqy b/deploy/lib/xquery/setup.xqy index 148895e9..98f36461 100644 --- a/deploy/lib/xquery/setup.xqy +++ b/deploy/lib/xquery/setup.xqy @@ -4744,7 +4744,26 @@ 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), + + {xdmp:security-database()} + + ), + setup:add-rollback("amps", $amp) + ) else ( xdmp:eval( From 6411f6572d7ce3fac06747e5a4809269df7c2b47 Mon Sep 17 00:00:00 2001 From: Tony Apuzzo Date: Wed, 25 May 2016 10:55:16 -0400 Subject: [PATCH 2/2] Don't rollback amp updates, per dmcassel suggestion. --- deploy/lib/xquery/setup.xqy | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/deploy/lib/xquery/setup.xqy b/deploy/lib/xquery/setup.xqy index 98f36461..136525c5 100644 --- a/deploy/lib/xquery/setup.xqy +++ b/deploy/lib/xquery/setup.xqy @@ -4761,8 +4761,7 @@ declare function setup:create-amps($import-config) {xdmp:security-database()} - ), - setup:add-rollback("amps", $amp) + ) ) else (