aboutsummaryrefslogtreecommitdiff
path: root/scripts/hostclass/dav_server
diff options
context:
space:
mode:
authorCullum Smith <cullum@sacredheartsc.com>2024-10-31 21:36:39 -0400
committerCullum Smith <cullum@sacredheartsc.com>2024-10-31 21:36:39 -0400
commit2c9845db4bc00221bc3c2343a020208f7f532166 (patch)
tree843bc24a1bbf2cad33c4bdc8a17c3d0d838fceb4 /scripts/hostclass/dav_server
parent7eb111136453d0e8d8451d7dd85ba9892318f294 (diff)
downloadinfrastructure-2c9845db4bc00221bc3c2343a020208f7f532166.tar.gz
many fixes
Diffstat (limited to 'scripts/hostclass/dav_server')
-rw-r--r--scripts/hostclass/dav_server12
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/hostclass/dav_server b/scripts/hostclass/dav_server
index a69c072..e39b08c 100644
--- a/scripts/hostclass/dav_server
+++ b/scripts/hostclass/dav_server
@@ -9,6 +9,7 @@
: ${davical_branch:='master'}
: ${davical_awl_repo:='https://gitlab.com/davical-project/awl.git'}
: ${davical_awl_branch:='master'}
+: ${davical_admins:=''}
davical_dn="uid=${davical_username},${robots_basedn}"
davical_repo_dir=/usr/local/www/davical
@@ -105,6 +106,17 @@ if ! davical_psql -c 'SELECT 1 FROM awl_db_revision'; then
davical_psql -c "delete from usr where username = 'admin'"
fi
+if [ -n "$davical_admins" ]; then
+ # Note: This won't work until each admin in $davical_admins has logged in
+ # at least once.
+ davical_psql -c \
+ "INSERT INTO role_member (user_no, role_no)
+ SELECT user_no, (SELECT role_no FROM roles WHERE role_name = 'Admin')
+ FROM usr
+ WHERE username in ('$(join "','" $davical_admins)')
+ ON CONFLICT DO NOTHING"
+fi
+
# Copy TLS certificate for nginx.
install_certificate nginx "$davical_https_cert"
install_certificate_key nginx "$davical_https_key"