Skip to content

Instantly share code, notes, and snippets.

@joewiz
Created June 3, 2021 20:54
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save joewiz/7fa6eed2b8fa142cd8103cbc7a82ca23 to your computer and use it in GitHub Desktop.
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