diff --git a/OGoContentStore/sql/acls.sh b/OGoContentStore/sql/acls.sh new file mode 100755 index 000000000..adf7f77be --- /dev/null +++ b/OGoContentStore/sql/acls.sh @@ -0,0 +1,106 @@ +#!/bin/bash +# +# Usage: generate-folderinfo-sql-for-users user1 [user2] [user3] [...] +# + +DB_USER="sogo" +DB_PASS="sogo" +DB_HOST="192.168.0.4" +DB_PORT="5432" +DB_NAME="sogo" +TIMEZONE="Canada/Eastern" + + +while [ "$1" != "" ]; do +USER_ID=$1 +USER_TABLE=`echo $USER_ID | tr -s [:punct:] _` +cat << EOF +-- +-- (C) 2004 SKYRIX Software AG +-- +-- TODO: +-- add a unique constraints on path + +DELETE FROM SOGo_folder_info WHERE c_path2 = '${USER_ID}' AND c_folder_type = 'Acls'; + +INSERT INTO SOGo_folder_info + ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, + c_location, c_quick_location, c_folder_type ) +VALUES + ( '/Users/${USER_ID}/acls', + 'Users', + '${USER_ID}', + 'acls', + NULL, + 'acls', + 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_acls', + 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_acls', + 'Acls' ); + +INSERT INTO SOGo_folder_info + ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, + c_location, c_quick_location, c_folder_type ) +VALUES + ( '/Users/${USER_ID}/Calendar/acls', + 'Users', + '${USER_ID}', + 'Calendar', + 'acls', + 'acls', + 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_privcal_acls', + 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_privcal_acls', + 'Acls' ); + +INSERT INTO SOGo_folder_info + ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, + c_location, c_quick_location, c_folder_type ) +VALUES + ( '/Users/${USER_ID}/Contacts/acls', + 'Users', + '${USER_ID}', + 'Contacts', + 'acls', + 'acls', + 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_contacts_acls', + 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_contacts_acls', + 'Acls' ); + +INSERT INTO SOGo_folder_info + ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, + c_location, c_quick_location, c_folder_type ) +VALUES + ( '/Users/${USER_ID}/Contacts/personal/acls', + 'Users', + '${USER_ID}', + 'Contacts', + 'personal', + 'acls', + 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_contacts_acls', + 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_contacts_acls', + 'Acls' ); + +DROP TABLE SOGo_${USER_TABLE}_acls; +DROP TABLE SOGo_${USER_TABLE}_privcal_acls; +DROP TABLE SOGo_${USER_TABLE}_contacts_acls; + +CREATE TABLE SOGo_${USER_TABLE}_acls ( + uid VARCHAR(256) NOT NULL, + object VARCHAR(256) NOT NULL, + role VARCHAR(80) NOT NULL +); + +CREATE TABLE SOGo_${USER_TABLE}_privcal_acls ( + uid VARCHAR(256) NOT NULL, + object VARCHAR(256) NOT NULL, + role VARCHAR(80) NOT NULL +); + +CREATE TABLE SOGo_${USER_TABLE}_contacts_acls ( + uid VARCHAR(256) NOT NULL, + object VARCHAR(256) NOT NULL, + role VARCHAR(80) NOT NULL +); + +EOF +shift +done diff --git a/OGoContentStore/sql/generate-folderinfo-sql-for-users.sh b/OGoContentStore/sql/generate-folderinfo-sql-for-users.sh index bd99c5545..41140f6fb 100755 --- a/OGoContentStore/sql/generate-folderinfo-sql-for-users.sh +++ b/OGoContentStore/sql/generate-folderinfo-sql-for-users.sh @@ -65,66 +65,9 @@ VALUES 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_contacts_quick', 'Contact' ); -INSERT INTO SOGo_folder_info - ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, - c_location, c_quick_location, c_folder_type ) -VALUES - ( '/Users/${USER_ID}/acls', - 'Users', - '${USER_ID}', - 'acls', - NULL, - 'acls', - 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_user_acls', - 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_user_acls', - 'Acls' ); - -INSERT INTO SOGo_folder_info - ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, - c_location, c_quick_location, c_folder_type ) -VALUES - ( '/Users/${USER_ID}/Calendar/acls', - 'Users', - '${USER_ID}', - 'Calendar', - 'acls', - 'acls', - 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_privcal_acls', - 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_privcal_acls', - 'Acls' ); - -INSERT INTO SOGo_folder_info - ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, - c_location, c_quick_location, c_folder_type ) -VALUES - ( '/Users/${USER_ID}/Contacts/acls', - 'Users', - '${USER_ID}', - 'Contacts', - 'acls', - 'acls', - 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_contacts_acls', - 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_contacts_acls', - 'Acls' ); - -DROP TABLE SOGo_${USER_TABLE}_acls; - -CREATE TABLE SOGo_${USER_TABLE}_acls ( - uid VARCHAR(256) NOT NULL, - object VARCHAR(256) NOT NULL, - role VARCHAR(80) NOT NULL -); - -DROP TABLE SOGo_${USER_TABLE}_privcal_acls; DROP TABLE SOGo_${USER_TABLE}_privcal_quick; DROP TABLE SOGo_${USER_TABLE}_privcal; -CREATE TABLE SOGo_${USER_TABLE}_privcal_acls ( - uid VARCHAR(256) NOT NULL, - object VARCHAR(256) NOT NULL, - role VARCHAR(80) NOT NULL -); - CREATE TABLE SOGo_${USER_TABLE}_privcal_quick ( c_name VARCHAR(256) NOT NULL PRIMARY KEY, -- the filename uid VARCHAR(256) NOT NULL, @@ -156,16 +99,9 @@ CREATE TABLE SOGo_${USER_TABLE}_privcal ( c_version INT NOT NULL -- version counter ); -DROP TABLE SOGo_${USER_TABLE}_contacts_acls; DROP TABLE SOGo_${USER_TABLE}_contacts_quick; DROP TABLE SOGo_${USER_TABLE}_contacts; -CREATE TABLE SOGo_${USER_TABLE}_contacts_acls ( - uid VARCHAR(256) NOT NULL, - object VARCHAR(256) NOT NULL, - role VARCHAR(80) NOT NULL -); - CREATE TABLE SOGo_${USER_TABLE}_contacts_quick ( c_name VARCHAR(256) NOT NULL PRIMARY KEY, -- the filename givenname VARCHAR(256), diff --git a/OGoContentStore/sql/sogo-folderinfo.sh b/OGoContentStore/sql/sogo-folderinfo.sh new file mode 100755 index 000000000..5095eec82 --- /dev/null +++ b/OGoContentStore/sql/sogo-folderinfo.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# Usage: generate-folderinfo-sql-for-users user1 [user2] [user3] [...] +# + +DB_USER="sogo" +DB_PASS="sogo" +DB_HOST="192.168.0.4" +DB_PORT="5432" +DB_NAME="sogo" +TIMEZONE="Canada/Eastern" + + +while [ "$1" != "" ]; do +USER_ID=$1 +USER_TABLE=`echo $USER_ID | tr -s [:punct:] _` +cat << EOF +-- +-- (C) 2004 SKYRIX Software AG +-- +-- TODO: +-- add a unique constraints on path + +DELETE FROM SOGo_folder_info WHERE c_path2 = '${USER_ID}'; + +INSERT INTO SOGo_folder_info + ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, + c_location, c_quick_location, c_folder_type ) +VALUES + ( '/Users/${USER_ID}', + 'Users', + '${USER_ID}', + NULL, + NULL, + '${USER_ID}', + 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_user_folder', + 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_user_folder_quick', + 'Container' ); + +INSERT INTO SOGo_folder_info + ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, + c_location, c_quick_location, c_folder_type ) +VALUES + ( '/Users/${USER_ID}/Calendar', + 'Users', + '${USER_ID}', + 'Calendar', + NULL, + 'Calendar', + 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_privcal', + 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_privcal_quick', + 'Appointment' ); + +INSERT INTO SOGo_folder_info + ( c_path, c_path1, c_path2, c_path3, c_path4, c_foldername, + c_location, c_quick_location, c_folder_type ) +VALUES + ( '/Users/${USER_ID}/Contacts/personal', + 'Users', + '${USER_ID}', + 'Contacts', + 'personal', + 'Contacts', + 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_contacts', + 'http://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}/SOGo_${USER_TABLE}_contacts_quick', + 'Contact' ); + +EOF +shift +done