From 3ce3c74273ce86eda133d15d8dce95706c03699b Mon Sep 17 00:00:00 2001 From: Helmuth Gronewold Date: Tue, 26 Aug 2014 23:15:09 +0200 Subject: [PATCH 1/2] Add a helper script to unlock ownClouds admin features --- tools/owncloud-unlockadmin.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tools/owncloud-unlockadmin.sh diff --git a/tools/owncloud-unlockadmin.sh b/tools/owncloud-unlockadmin.sh new file mode 100644 index 0000000..ea052cd --- /dev/null +++ b/tools/owncloud-unlockadmin.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +source /etc/mailinabox.conf # load global vars + +ADMIN=$(sqlite3 $STORAGE_ROOT/mail/users.sqlite "SELECT email FROM users WHERE privileges = 'admin' ORDER BY id ASC LIMIT 1") +test -z "$1" || ADMIN=$1 + +echo I am going to unlock admin features for $ADMIN. +echo You can provide another user to unlock as the first argument of this script. +echo +echo WARNING: you could break mail-in-a-box when fiddling around with owncloud\'s admin interface +echo If in doubt, press CTRL-C to cancel. +echo +echo Press enter to continue. +read + +sqlite3 $STORAGE_ROOT/owncloud/owncloud.db "INSERT OR IGNORE INTO oc_group_user VALUES ('admin', '$ADMIN')" && echo Done. From 1f19a855af5ba0aacc083a8857dcb9e863b06976 Mon Sep 17 00:00:00 2001 From: Helmuth Gronewold Date: Tue, 26 Aug 2014 23:34:27 +0200 Subject: [PATCH 2/2] Use mail.py to get the admin user --- tools/owncloud-unlockadmin.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/owncloud-unlockadmin.sh b/tools/owncloud-unlockadmin.sh index ea052cd..772cadd 100644 --- a/tools/owncloud-unlockadmin.sh +++ b/tools/owncloud-unlockadmin.sh @@ -2,7 +2,7 @@ source /etc/mailinabox.conf # load global vars -ADMIN=$(sqlite3 $STORAGE_ROOT/mail/users.sqlite "SELECT email FROM users WHERE privileges = 'admin' ORDER BY id ASC LIMIT 1") +ADMIN=$(./mail.py user admins | head -n 1) test -z "$1" || ADMIN=$1 echo I am going to unlock admin features for $ADMIN.