Просмотр исходного кода

Install the carddav plugin so owncloud contacts can be used (fixes #154)

Justin Plock 10 лет назад
Родитель
Сommit
876b81a1a7
Аккаунт пользователя с таким Email не найден

+ 1
- 1
roles/webmail/files/etc_roundcube_main.inc.php Просмотреть файл

@@ -362,7 +362,7 @@ $rcmail_config['email_dns_check'] = false;
362 362
 // ----------------------------------
363 363
 
364 364
 // List of active plugins (in plugins/ directory)
365
-$rcmail_config['plugins'] = array('managesieve');
365
+$rcmail_config['plugins'] = array('managesieve', 'carddav');
366 366
 
367 367
 // ----------------------------------
368 368
 // USER INTERFACE

+ 185
- 0
roles/webmail/files/usr_share_roundcube_plugins_carddav_config.inc.php Просмотреть файл

@@ -0,0 +1,185 @@
1
+<?php
2
+
3
+//// RCMCardDAV Plugin Admin Settings
4
+
5
+//// ** GLOBAL SETTINGS
6
+
7
+// Disallow users to add / edit / delete custom addressbooks (default: false)
8
+//
9
+// If true, User cannot add custom addressbooks
10
+// If false, user can add / edit / delete custom addressbooks
11
+//
12
+// This option only affects custom addressbooks. Preset addressbooks (see below)
13
+// are not affected.
14
+// $prefs['_GLOBAL']['fixed'] = true;
15
+
16
+// When enabled, this option hides the 'CardDAV' section inside Preferences.
17
+// $prefs['_GLOBAL']['hide_preferences'] = false;
18
+
19
+// Scheme for storing the CardDAV passwords.
20
+// Options:
21
+// plain: store as plaintext
22
+// base64: store encoded with base64 (default)
23
+// encrypted: store encrypted with IMAP password of the user
24
+//            NOTE: if the IMAP password of the user changes, the stored
25
+//             CardDAV passwords cannot be decrypted anymore and the user
26
+//             needs to reenter them.
27
+// $prefs['_GLOBAL']['pwstore_scheme'] = 'base64';
28
+
29
+//// ** ADDRESSBOOK PRESETS
30
+
31
+// Each addressbook preset takes the following form:
32
+/*
33
+$prefs['<Presetname>'] = array(
34
+	// required attributes
35
+	'name'         =>  '<Addressbook Name>',
36
+	'username'     =>  '<CardDAV Username>',
37
+	'password'     =>  '<CardDAV Password>',
38
+	'url'          =>  '<CardDAV URL>',
39
+
40
+	// optional attributes
41
+	'active'       =>  <true or false>,
42
+	'readonly'     =>  <true or false>,
43
+	'refresh_time' => '<Refresh Time in Hours, Format HH[:MM[:SS]]>',
44
+	'preemptive_auth' => <1 or 0>,
45
+
46
+	// attributes that are fixed (i.e., not editable by the user) and
47
+	// auto-updated for this preset
48
+	'fixed'        =>  array( < 0 or more of the other attribute keys > ),
49
+
50
+	// hide this preset from CalDAV preferences section so users can't even
51
+	// see it
52
+	'hide' => <true or false>,
53
+);
54
+*/
55
+
56
+// All values in angle brackets <VALUE> have to be substituted.
57
+//
58
+// The meaning of the different parameters is as follows:
59
+//
60
+// <Presetname>: Unique preset name, must not be '_GLOBAL'. The presetname is
61
+//               not user visible and only used for an internal mapping between
62
+//               addressbooks created from a preset and the preset itself. You
63
+//               should never change this throughout its lifetime.
64
+//
65
+// The following parameters are REQUIRED and need to be specified for any preset.
66
+//
67
+// name:         User-visible name of the addressbook. If the server provides
68
+//               an additional display name for the addressbooks found for the
69
+//               preset, it will be appended in brackets to this name, except
70
+//               if carddav_name_only is true (see below).
71
+//
72
+// username:     CardDAV username to access the addressbook. Set this setting
73
+//               to '%u' to use the roundcube username.
74
+//
75
+// password:     CardDAV password to access the addressbook. Set this setting
76
+//               to '%p' to use the roundcube password. The password will not
77
+//               be stored in the database when using %p.
78
+//
79
+// url:          URL where to find the CardDAV addressbook(s). If the given URL
80
+//               refers directly to an addressbook, only this single
81
+//               addressbook will be added. If the URL points somewhere in the
82
+//               CardDAV space, but _not_ to the location of a particular
83
+//               addressbook, the server will be queried for the available
84
+//               addressbooks and all of them will be added. You can use %u
85
+//               within the URL as a placeholder for the CardDAV username.
86
+//
87
+// The following parameters are OPTIONAL and need to be specified only if the default
88
+// value is not acceptable.
89
+//
90
+// active:       If this parameter is false, the addressbook is not used by roundcube
91
+//               unless the user changes this setting.
92
+//               Default: true
93
+//
94
+// carddav_name_only:
95
+//               If this parameter is true, only the server provided displayname
96
+//               is used for addressbooks created from this preset, except if
97
+//               the server does not provide a display name.
98
+//               Default: false
99
+//
100
+// readonly:     If this parameter is true, the addressbook will only be
101
+//               accessible in read-only mode, i.e., the user will not be able
102
+//               to add, modify or delete contacts in the addressbook.
103
+//               Default: false
104
+//
105
+// refresh_time: Time interval for that cached versions of the addressbook
106
+//               entries should be used, in hours. After this time interval has
107
+//               passed since the last pull from the server, it will be
108
+//               refreshed when the addressbook is accessed the next time.
109
+//               Default: 01:00:00
110
+//
111
+// preemptive_auth:
112
+//               If this parameter is 1, the authentication headers will be sent
113
+//               automatically with every request, regardless of the server
114
+//               requesting them or not.
115
+//               This must be set for ownCloud to work correctly.
116
+//               Default: 0
117
+//
118
+// fixed:        Array of parameter keys that must not be changed by the user.
119
+//               Note that only fixed parameters will be automatically updated
120
+//               for existing addressbooks created from presets. Otherwise the
121
+//               user may already have changed the setting, and his change
122
+//               would be lost. You can add any of the above keys, but it the
123
+//               setting only affects parameters that can be changed via the
124
+//               settings pane (e.g., readonly cannot be changed by the user
125
+//               anyway). Still only parameters listed as fixed will
126
+//               automatically updated if the preset is changed.
127
+//               Default: empty, all settings modifiable by user
128
+//
129
+//               !!! WARNING: Only add 'url' to the list of fixed addressbooks
130
+//                if it _directly_ points to an address book collection.
131
+//                Otherwise, the plugin will initially lookup the URLs for the
132
+//                collections on the server, and at the next login overwrite it
133
+//                with the fixed value stored here. Therefore, if you change the
134
+//                URL, you have two options:
135
+//                1) If the new URL is a variation of the old one (e.g. hostname
136
+//                 change), you can run an SQL UPDATE query directly in the
137
+//                 database to adopt all addressbooks.
138
+//                2) If the new URL is not easily derivable from the old one,
139
+//                 change the key of the preset and change the URL. Addressbooks
140
+//                 belonging to the old preset will be deleted upon the next
141
+//                 login of the user and freshly created.
142
+//
143
+// hide:         Whether this preset should be hidden from the CalDAV listing
144
+//               on the preferences page.
145
+
146
+
147
+// How Preset Updates work
148
+//
149
+// Preset addressbooks are created for a user as she logs in.
150
+
151
+//// ** ADDRESSBOOK PRESETS - EXAMPLE: Two Addressbook Presets
152
+
153
+//// Preset 1: Personal
154
+/*
155
+$prefs['Personal'] = array(
156
+	// required attributes
157
+	'name'         =>  'Personal',
158
+	// will be substituted for the roundcube username
159
+	'username'     =>  '%u',
160
+	// will be substituted for the roundcube password
161
+	'password'     =>  '%p',
162
+	// %u will be substituted for the CardDAV username
163
+	'url'          =>  'https://ical.example.org/caldav.php/%u/Personal',
164
+
165
+	'active'       =>  true,
166
+	'readonly'     =>  false,
167
+	'refresh_time' => '02:00:00',
168
+
169
+	'fixed'        =>  array( 'username' ),
170
+	'hide'        =>  false,
171
+);
172
+*/
173
+
174
+//// Preset 2: Corporate
175
+/*
176
+$prefs['Work'] = array(
177
+	'name'         =>  'Corporate',
178
+	'username'     =>  'CorpUser',
179
+	'password'     =>  'C0rpPasswo2d',
180
+	'url'          =>  'https://ical.example.org/caldav.php/%u/Corporate',
181
+
182
+	'fixed'        =>  array( 'name', 'username', 'password' ),
183
+	'hide'        =>  true,
184
+);
185
+*/

+ 23
- 0
roles/webmail/tasks/roundcube.yml Просмотреть файл

@@ -8,6 +8,26 @@
8 8
 - name: Configure Roundcube database
9 9
   template: src=etc_dbconfig-common_roundcube.conf.j2 dest=/etc/dbconfig-common/roundcube.conf group=root owner=root force=yes
10 10
 
11
+- name: Download carddav plugin release
12
+  get_url:
13
+    url=https://github.com/blind-coder/rcmcarddav/archive/carddav_{{ carddav_version }}.tar.gz
14
+    dest=/root/carddav_{{ carddav_version }}.tar.gz
15
+
16
+- name: Decompress carddav plugin source
17
+  command: tar xzf carddav_{{ carddav_version }}.tar.gz chdir=/root creates=/root/rcmcarddav-carddav_{{ carddav_version }}
18
+
19
+- name: Create /usr/share/roundcube/plugins/carddav
20
+  file: state=directory path=/usr/share/roundcube/plugins/carddav
21
+
22
+- name: Copy carddav plugin files to /usr/share/roundcube/plugins/carddav
23
+  shell: cp -R rcmcarddav-carddav_{{ carddav_version }}/* /usr/share/roundcube/plugins/carddav/ chdir=/root
24
+
25
+- name: Link carddav plugin into /var/lib/roundcube/plugins
26
+  shell: ln -s /usr/share/roundcube/plugins/carddav chdir=/var/lib/roundcube/plugins
27
+
28
+- name: Remove downloaded, temporary carddav plugin source files
29
+  shell: rm -rf rcmcarddav-carddav_* carddav_* chdir=/root
30
+
11 31
 - name: Configure the Apache HTTP server for roundcube
12 32
   template: src=etc_apache2_sites-available_roundcube.j2 dest=/etc/apache2/sites-available/roundcube group=www-data owner=www-data force=yes
13 33
 
@@ -17,6 +37,9 @@
17 37
 - name: Configure roundcube's managesieve plugin
18 38
   copy: src=usr_share_roundcube_plugins_managesieve_config.inc.php dest=/usr/share/roundcube/plugins/managesieve/config.inc.php group=www-data owner=root mode=640 force=yes
19 39
 
40
+- name: Configure roundcube's carddav plugin
41
+  copy: src=usr_share_roundcube_plugins_carddav_config.inc.php dest=/usr/share/roundcube/plugins/carddav/config.inc.php group=www-data owner=root mode=640 force=yes
42
+
20 43
 - name: Copy global default sieve rules
21 44
   copy: src=etc_roundcube_global.sieve dest=/etc/roundcube/global.sieve owner=root group=www-data mode=640
22 45
 

+ 1
- 0
vars/defaults.yml Просмотреть файл

@@ -85,6 +85,7 @@ webmail_domain: "mail.{{ domain }}"
85 85
 webmail_db_username: "roundcube"
86 86
 # webmail_db_password: (required)
87 87
 webmail_db_database: "roundcube"
88
+carddav_version: "0.9.2"
88 89
 
89 90
 # xmpp
90 91
 prosody_admin: "{{ admin_email }}"

Загрузка…
Отмена
Сохранить