mirror of
https://github.com/YunoHost-Apps/z-push_ynh.git
synced 2024-09-03 18:05:58 +02:00
parent
5590e28efb
commit
5cf5429590
8 changed files with 183 additions and 30 deletions
110
conf/backend/config-autodiscover.php
Normal file
110
conf/backend/config-autodiscover.php
Normal file
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
/***********************************************
|
||||
* File : config.php
|
||||
* Project : Z-Push
|
||||
* Descr : Autodiscover configuration file
|
||||
*
|
||||
* Created : 30.07.2014
|
||||
*
|
||||
* Copyright 2007 - 2016 Zarafa Deutschland GmbH
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Consult LICENSE file for details
|
||||
************************************************/
|
||||
|
||||
/**********************************************************************************
|
||||
* Default settings
|
||||
*/
|
||||
|
||||
// Replace zpush.example.com with your z-push's host name and uncomment the line below.
|
||||
// define('ZPUSH_HOST', 'zpush.example.com');
|
||||
|
||||
// Defines the default time zone, change e.g. to "Europe/London" if necessary
|
||||
define('TIMEZONE', '__TIMEZONE__');
|
||||
|
||||
// Defines the base path on the server
|
||||
define('BASE_PATH', dirname($_SERVER['SCRIPT_FILENAME']). '/');
|
||||
|
||||
/*
|
||||
* Whether to use the complete email address as a login name
|
||||
* (e.g. user@company.com) or the username only (user).
|
||||
* Possible values:
|
||||
* false - use the username only (default).
|
||||
* true - use the complete email address.
|
||||
*/
|
||||
define('USE_FULLEMAIL_FOR_LOGIN', false);
|
||||
|
||||
/*
|
||||
* AutoDiscover requires the username to match either the email address
|
||||
* or the local part of the email address.
|
||||
* This is not always possible as the username might have a different
|
||||
* schema than email address. Configure this parameter to match your
|
||||
* username settings.
|
||||
* @see https://wiki.z-hub.io/display/ZP/Configuring+Z-Push+Autodiscover#ConfiguringZ-PushAutodiscover-Configuration
|
||||
* @see https://jira.z-hub.io/browse/ZP-1209
|
||||
*
|
||||
* Possible values:
|
||||
* AUTODISCOVER_LOGIN_EMAIL - uses the email address as provided when setting up the account
|
||||
* AUTODISCOVER_LOGIN_NO_DOT - removes the '.' from email address:
|
||||
* email: first.last@domain.com -> resulting username: firstlast
|
||||
* AUTODISCOVER_LOGIN_F_NO_DOT_LAST - cuts the first part before '.' after the first letter and
|
||||
* removes the '.' from email address:
|
||||
* email: first.last@domain.com -> resulting username: flast
|
||||
* AUTODISCOVER_LOGIN_F_DOT_LAST - cuts the part before '.' after the first letter and
|
||||
* leaves the part after '.' as is:
|
||||
* email: first.last@domain.com -> resulting username: f.last
|
||||
*/
|
||||
define('AUTODISCOVER_LOGIN_TYPE', AUTODISCOVER_LOGIN_EMAIL);
|
||||
|
||||
/**********************************************************************************
|
||||
* Logging settings
|
||||
* Possible LOGLEVEL and LOGUSERLEVEL values are:
|
||||
* LOGLEVEL_OFF - no logging
|
||||
* LOGLEVEL_FATAL - log only critical errors
|
||||
* LOGLEVEL_ERROR - logs events which might require corrective actions
|
||||
* LOGLEVEL_WARN - might lead to an error or require corrective actions in the future
|
||||
* LOGLEVEL_INFO - usually completed actions
|
||||
* LOGLEVEL_DEBUG - debugging information, typically only meaningful to developers
|
||||
* LOGLEVEL_WBXML - also prints the WBXML sent to/from the device
|
||||
* LOGLEVEL_DEVICEID - also prints the device id for every log entry
|
||||
* LOGLEVEL_WBXMLSTACK - also prints the contents of WBXML stack
|
||||
*
|
||||
* The verbosity increases from top to bottom. More verbose levels include less verbose
|
||||
* ones, e.g. setting to LOGLEVEL_DEBUG will also output LOGLEVEL_FATAL, LOGLEVEL_ERROR,
|
||||
* LOGLEVEL_WARN and LOGLEVEL_INFO level entries.
|
||||
*/
|
||||
|
||||
define('LOGBACKEND', 'filelog');
|
||||
|
||||
define('LOGFILEDIR', '__FINAL_LOGPATH__/');
|
||||
define('LOGFILE', LOGFILEDIR . 'autodiscover.log');
|
||||
define('LOGERRORFILE', LOGFILEDIR . 'autodiscover-error.log');
|
||||
define('LOGLEVEL', LOGLEVEL_INFO);
|
||||
define('LOGUSERLEVEL', LOGLEVEL);
|
||||
$specialLogUsers = array();
|
||||
|
||||
// Syslog settings
|
||||
// false will log to local syslog, otherwise put the remote syslog IP here
|
||||
define('LOG_SYSLOG_HOST', false);
|
||||
// Syslog port
|
||||
define('LOG_SYSLOG_PORT', 514);
|
||||
// Program showed in the syslog. Useful if you have more than one instance login to the same syslog
|
||||
define('LOG_SYSLOG_PROGRAM', 'z-push-autodiscover');
|
||||
// Syslog facility - use LOG_USER when running on Windows
|
||||
define('LOG_SYSLOG_FACILITY', LOG_LOCAL0);
|
||||
/**********************************************************************************
|
||||
* Backend settings
|
||||
*/
|
||||
// the backend data provider
|
||||
define('BACKEND_PROVIDER', '__BACKEND__');
|
|
@ -53,7 +53,7 @@ define('CARDDAV_PATH', '__BAIKALPATH__/card.php/addressbooks/%u/');
|
|||
// %u: replaced with the username
|
||||
// %d: replaced with the domain
|
||||
// Add the trailing /
|
||||
define('CARDDAV_DEFAULT_PATH', 'BAIKALPATH/card.php/addressbooks/%u/default');
|
||||
define('CARDDAV_DEFAULT_PATH', '__BAIKALPATH__/card.php/addressbooks/%u/default');
|
||||
|
||||
// Server path to the GAL addressbook. This addressbook is readonly and searchable by the user, but it will NOT be synced.
|
||||
// If you don't want GAL, comment it
|
||||
|
|
|
@ -47,10 +47,22 @@ class BackendCombinedConfig {
|
|||
'i' => array(
|
||||
'name' => 'BackendIMAP',
|
||||
),
|
||||
'z' => array(
|
||||
'name' => 'BackendKopano',
|
||||
),
|
||||
'm' => array(
|
||||
'name' => 'BackendMaildir',
|
||||
),
|
||||
'v' => array(
|
||||
'name' => 'BackendVCardDir',
|
||||
),
|
||||
'l' => array(
|
||||
'name' => 'BackendLDAP',
|
||||
),
|
||||
'd' => array(
|
||||
'name' => 'BackendCardDAV',
|
||||
),
|
||||
'l' => array(
|
||||
'c' => array(
|
||||
'name' => 'BackendCalDAV',
|
||||
),
|
||||
),
|
||||
|
@ -63,18 +75,18 @@ class BackendCombinedConfig {
|
|||
SYNC_FOLDER_TYPE_WASTEBASKET => 'i',
|
||||
SYNC_FOLDER_TYPE_SENTMAIL => 'i',
|
||||
SYNC_FOLDER_TYPE_OUTBOX => 'i',
|
||||
SYNC_FOLDER_TYPE_TASK => 'l',
|
||||
SYNC_FOLDER_TYPE_APPOINTMENT => 'l',
|
||||
SYNC_FOLDER_TYPE_TASK => 'c',
|
||||
SYNC_FOLDER_TYPE_APPOINTMENT => 'c',
|
||||
SYNC_FOLDER_TYPE_CONTACT => 'd',
|
||||
SYNC_FOLDER_TYPE_NOTE => 'l',
|
||||
SYNC_FOLDER_TYPE_JOURNAL => 'l',
|
||||
SYNC_FOLDER_TYPE_NOTE => 'c',
|
||||
SYNC_FOLDER_TYPE_JOURNAL => 'c',
|
||||
SYNC_FOLDER_TYPE_OTHER => 'i',
|
||||
SYNC_FOLDER_TYPE_USER_MAIL => 'i',
|
||||
SYNC_FOLDER_TYPE_USER_APPOINTMENT => 'l',
|
||||
SYNC_FOLDER_TYPE_USER_APPOINTMENT => 'c',
|
||||
SYNC_FOLDER_TYPE_USER_CONTACT => 'd',
|
||||
SYNC_FOLDER_TYPE_USER_TASK => 'l',
|
||||
SYNC_FOLDER_TYPE_USER_JOURNAL => 'l',
|
||||
SYNC_FOLDER_TYPE_USER_NOTE => 'l',
|
||||
SYNC_FOLDER_TYPE_USER_TASK => 'c',
|
||||
SYNC_FOLDER_TYPE_USER_JOURNAL => 'c',
|
||||
SYNC_FOLDER_TYPE_USER_NOTE => 'c',
|
||||
SYNC_FOLDER_TYPE_UNKNOWN => 'i',
|
||||
),
|
||||
//creating a new folder in the root folder should create a folder in one backend
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
* false - use the username only.
|
||||
* true - string the mobile sends as username, e.g. full email address (default).
|
||||
*/
|
||||
define('USE_FULLEMAIL_FOR_LOGIN', true);
|
||||
define('USE_FULLEMAIL_FOR_LOGIN', false);
|
||||
|
||||
/**********************************************************************************
|
||||
* StateMachine setting
|
||||
|
|
|
@ -21,3 +21,27 @@ location /Microsoft-Server-ActiveSync {
|
|||
# Include SSOWAT user panel.
|
||||
include conf.d/yunohost_panel.conf.inc;
|
||||
}
|
||||
|
||||
location /AutoDiscover/AutoDiscover.xml {
|
||||
alias __FINALPATH__/autodiscover/autodiscover.php;
|
||||
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||
include fastcgi_params;
|
||||
fastcgi_param HTTPS on;
|
||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||
}
|
||||
|
||||
location /Autodiscover/Autodiscover.xml {
|
||||
alias __FINALPATH__/autodiscover/autodiscover.php;
|
||||
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||
include fastcgi_params;
|
||||
fastcgi_param HTTPS on;
|
||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||
}
|
||||
|
||||
location /autodiscover/autodiscover.xml {
|
||||
alias __FINALPATH__/autodiscover/autodiscover.php;
|
||||
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
|
||||
include fastcgi_params;
|
||||
fastcgi_param HTTPS on;
|
||||
fastcgi_param SCRIPT_FILENAME $request_filename;
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
pkg_dependencies="php-soap php5-imap libawl-php php5-xsl"
|
||||
pkg_dependencies="php-soap php-imap libawl-php php-xsl php-curl libawl-php php-xml php-ldap php-cli php-mbstring php-memcached"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
|
|
|
@ -100,24 +100,23 @@ ynh_print_info "Creating statedir and final_logpath..."
|
|||
mkdir -p $statedir
|
||||
chown -R www-data:www-data $statedir
|
||||
|
||||
|
||||
mkdir -p $final_logpath
|
||||
chown -R www-data:www-data $final_logpath
|
||||
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
|
||||
# Configuration
|
||||
ynh_replace_string __TIMEZONE__ $(cat /etc/timezone) ../conf/config.php
|
||||
ynh_replace_string __TIMEZONE__ $(cat /etc/timezone) ../conf/backend/config-autodiscover.php
|
||||
ynh_replace_string __FINAL_LOGPATH__ $final_logpath ../conf/config.php
|
||||
ynh_replace_string __FINAL_LOGPATH__ $final_logpath ../conf/backend/config-autodiscover.php
|
||||
|
||||
# Storage of state_dir in /home/yunohost.app
|
||||
# This contains the sync status in between device and z-push
|
||||
ynh_replace_string __STATEDIR__ $statedir ../conf/config.php
|
||||
|
||||
|
||||
# Enable caldav carddav support
|
||||
if yunohost app list --installed -f baikal | grep -q id ; then
|
||||
echo "Detected Baikal"
|
||||
|
@ -127,10 +126,13 @@ if yunohost app list --installed -f baikal | grep -q id ; then
|
|||
|
||||
# Configuration of backend
|
||||
ynh_replace_string __BACKEND__ BackendCombined ../conf/config.php
|
||||
ynh_replace_string __BACKEND__ BackendCombined ../conf/backend/config-autodiscover.php
|
||||
|
||||
# Configuration baikal
|
||||
ynh_replace_string __BAIKALDOMAIN__ $caldavdomain ../conf/backend/config*.php
|
||||
ynh_replace_string __BAIKALPATH__ $caldavpath ../conf/backend/config*.php
|
||||
ynh_replace_string __BAIKALDOMAIN__ $caldavdomain ../conf/backend/config-caldav.php
|
||||
ynh_replace_string __BAIKALDOMAIN__ $caldavdomain ../conf/backend/config-carddav.php
|
||||
ynh_replace_string __BAIKALPATH__ $caldavpath ../conf/backend/config-caldav.php
|
||||
ynh_replace_string __BAIKALPATH__ $caldavpath ../conf/backend/config-carddav.php
|
||||
ynh_replace_string __DOMAINTOCHANGE__ $domain ../conf/backend/config-imap.php
|
||||
ynh_replace_string __FLAGTOCHANGE__ true ../conf/backend/config-imap.php
|
||||
|
||||
|
@ -140,15 +142,18 @@ if yunohost app list --installed -f baikal | grep -q id ; then
|
|||
cp ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php
|
||||
cp ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php
|
||||
cp ../conf/backend/config-combined.php $final_path/backend/combined/config.php
|
||||
cp ../conf/backend/config-autodiscover.php $final_path/autodiscover/config.php
|
||||
else
|
||||
# Configuration of backend
|
||||
ynh_replace_string __BACKEND__ BackendIMAP ../conf/config.php
|
||||
ynh_replace_string __BACKEND__ BackendIMAP ../conf/backend/config-autodiscover.php
|
||||
|
||||
# Copy config
|
||||
cp ../conf/config.php $final_path/config.php
|
||||
ynh_replace_string __DOMAINTOCHANGE__ $domain ../conf/backend/config-imap.php
|
||||
ynh_replace_string __FLAGTOCHANGE__ false ../conf/backend/config-imap.php
|
||||
cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php
|
||||
cp ../conf/backend/config-autodiscover.php $final_path/autodiscover/config.php
|
||||
fi
|
||||
|
||||
#Copy XMLElement.php
|
||||
|
@ -168,7 +173,6 @@ chown -R www-data: $final_path
|
|||
#=================================================
|
||||
ynh_print_info "Configuring log rotation..."
|
||||
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate
|
||||
|
||||
|
@ -178,7 +182,8 @@ ynh_use_logrotate
|
|||
ynh_print_info "Configuring SSOwat..."
|
||||
|
||||
# Make app public
|
||||
ynh_app_setting_set $app skipped_uris "/"
|
||||
ynh_app_setting_set $app unprotected_uris "/"
|
||||
ynh_app_setting_set $app skipped_regex "^[^/]*/[Aa]uto[Dd]iscover.*"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
|
@ -86,7 +86,6 @@ ynh_clean_setup () {
|
|||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
|
@ -131,7 +130,9 @@ ynh_add_fpm_config
|
|||
|
||||
# Configuration
|
||||
ynh_replace_string __TIMEZONE__ $(cat /etc/timezone) ../conf/config.php
|
||||
ynh_replace_string __TIMEZONE__ $(cat /etc/timezone) ../conf/backend/config-autodiscover.php
|
||||
ynh_replace_string __FINAL_LOGPATH__ $final_logpath ../conf/config.php
|
||||
ynh_replace_string __FINAL_LOGPATH__ $final_logpath ../conf/backend/config-autodiscover.php
|
||||
|
||||
# Storage of state_dir in /home/yunohost.app
|
||||
# This contains the sync status in between device and z-push
|
||||
|
@ -146,10 +147,13 @@ if yunohost app list --installed -f baikal | grep -q id ; then
|
|||
|
||||
# Configuration of backend
|
||||
ynh_replace_string __BACKEND__ BackendCombined ../conf/config.php
|
||||
ynh_replace_string __BACKEND__ BackendCombined ../conf/backend/config-autodiscover.php
|
||||
|
||||
# Configuration baikal
|
||||
ynh_replace_string __BAIKALDOMAIN__ $caldavdomain ../conf/backend/config*.php
|
||||
ynh_replace_string __BAIKALPATH__ $caldavpath ../conf/backend/config*.php
|
||||
ynh_replace_string __BAIKALDOMAIN__ $caldavdomain ../conf/backend/config-caldav.php
|
||||
ynh_replace_string __BAIKALDOMAIN__ $caldavdomain ../conf/backend/config-carddav.php
|
||||
ynh_replace_string __BAIKALPATH__ $caldavpath ../conf/backend/config-caldav.php
|
||||
ynh_replace_string __BAIKALPATH__ $caldavpath ../conf/backend/config-carddav.php
|
||||
ynh_replace_string __DOMAINTOCHANGE__ $domain ../conf/backend/config-imap.php
|
||||
ynh_replace_string __FLAGTOCHANGE__ true ../conf/backend/config-imap.php
|
||||
|
||||
|
@ -159,15 +163,18 @@ if yunohost app list --installed -f baikal | grep -q id ; then
|
|||
cp ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php
|
||||
cp ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php
|
||||
cp ../conf/backend/config-combined.php $final_path/backend/combined/config.php
|
||||
cp ../conf/backend/config-autodiscover.php $final_path/autodiscover/config.php
|
||||
else
|
||||
# Configuration of backend
|
||||
ynh_replace_string __BACKEND__ BackendIMAP ../conf/config.php
|
||||
ynh_replace_string __BACKEND__ BackendIMAP ../conf/backend/config-autodiscover.php
|
||||
|
||||
# Copy config
|
||||
cp ../conf/config.php $final_path/config.php
|
||||
ynh_replace_string __DOMAINTOCHANGE__ $domain ../conf/backend/config-imap.php
|
||||
ynh_replace_string __FLAGTOCHANGE__ false ../conf/backend/config-imap.php
|
||||
cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php
|
||||
cp ../conf/backend/config-autodiscover.php $final_path/autodiscover/config.php
|
||||
fi
|
||||
|
||||
# Fixstates to avoid full resync of devices after version upgrades
|
||||
|
@ -190,19 +197,14 @@ ynh_use_logrotate --non-append
|
|||
# Set permissions on app files
|
||||
chown -R www-data: $final_path
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_print_info "Upgrading SSOwat configuration..."
|
||||
|
||||
ynh_app_setting_set $app skipped_uris "/"
|
||||
# Make app public
|
||||
ynh_app_setting_set $app unprotected_uris "/"
|
||||
ynh_app_setting_set $app skipped_regex "^[^/]*/[Aa]uto[Dd]iscover.*"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
Loading…
Add table
Reference in a new issue