[horde] Apply global preferences

Jigish Gohil jigish.gohil at gmail.com
Tue May 17 02:31:05 PDT 2005


Below are the steps to copy preferences of one user to all the other
users which are listed in the userlist text file.

1. Create an user account and set the preferences up for that account
the way you want all the other accounts set up.
2. Create a plain text file containing the list of all the users and
name it users.txt e.g.

user1
user2
user3

3. Copy the script below and save it as defaultprofile.sh

#start script
#!/usr/bin/ksh

NEW_USERS="/data/users.txt"
cat ${NEW_USERS} | \
while read USER
do
echo "DROP TABLE default_prefs;"
echo "CREATE TABLE default_prefs as SELECT * FROM horde_prefs WHERE
pref_uid='publicprofile';"
echo "UPDATE default_prefs set pref_uid = '$USER';"
echo "DELETE FROM horde_prefs where pref_uid = '$USER';"
echo "INSERT INTO horde_prefs SELECT * FROM default_prefs;"
echo "COMMIT;"
done

#end of script

4. run the following command at the shell prompt

sh defaultprofile.sh > applypref.sql

5. after creating apply pref.sql run the following commands at the shell

su horde
psql -d horde < applypref.sql

That will copy all the preferences from one default user.

Jigish Gohil

PS - It would be nice if someone could put this up on wiki how-to, I
tried looking for something like 'Add how-to' but couldnt find it.


More information about the horde mailing list