Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Batch change permissions on resources and collections in eXist-db
xquery version "3.1";
import module namespace dbutil="http://exist-db.org/xquery/dbutil";
dbutil:scan(
xs:anyURI("/db/apps/airlock-data"),
function($col, $res) {
if ($res) then
(: Set permissions on resources here :)
(
sm:chgrp($res, "airlock"),
sm:chmod($res, "rwxrwxr-x")
)
else
(: Set permissions on collections here :)
(
sm:chgrp($col, "airlock"),
sm:chmod($col, "rwxrwxr-x")
)
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment