Created
June 3, 2021 20:54
-
-
Save joewiz/7fa6eed2b8fa142cd8103cbc7a82ca23 to your computer and use it in GitHub Desktop.
Batch change permissions on resources and collections in eXist-db
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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