5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
|
# File 'lib/puppet/functions/sogo/to_plist.rb', line 5
Puppet::Functions.create_function(:'sogo::to_plist') do
dispatch :to_plist do
param 'Any', :data
optional_param 'Integer', :indent
end
def to_plist(data, indent = 1)
res = nil
case data
when true
return 'YES'
when false
return 'NO'
when String
return %("#{data}")
when Array
res = "(\n#{data.map { |item| " #{to_plist(item)},\n" }.join})"
when Hash
res = "{\n#{data.map { |key, value| " #{normalize_key(key)} = #{to_plist(value)};\n" }.join}}"
when Puppet::Pops::Types::PSensitiveType::Sensitive
return to_plist(data.unwrap, indent)
else
return data.to_s
end
res.gsub("\n", "\n#{' ' * indent}")
end
def normalize_key(name)
{
'workers_count' => 'WOWorkersCount',
'listen_queue_size' => 'WOListenQueueSize',
'port' => 'WOPort',
'log_file' => 'WOLogFile',
'pid_file' => 'WOPidFile',
'watch_dog_request_timeout' => 'WOWatchDogRequestTimeout',
'max_upload_size' => 'WOMaxUploadSize',
'maximum_message_size_limit' => 'SOGoMaximumMessageSizeLimit',
'mem_limit' => 'SxVMemLimit',
'memcached_host' => 'SOGoMemcachedHost',
'cache_cleanup_interval' => 'SOGoCacheCleanupInterval',
'authentication_type' => 'SOGoAuthenticationType',
'trust_proxy_authentication' => 'SOGoTrustProxyAuthentication',
'encryption_key' => 'SOGoEncryptionKey',
'cas_service_url' => 'SOGoCASServiceURL',
'cas_logout_enabled' => 'SOGoCASLogoutEnabled',
'address_book_dav_access_enabled' => 'SOGoAddressBookDAVAccessEnabled',
'calendar_dav_access_enabled' => 'SOGoCalendarDAVAccessEnabled',
'saml2_private_key_location' => 'SOGoSAML2PrivateKeyLocation',
'saml2_certificate_location' => 'SOGoSAML2CertificateLocation',
'saml2_idp_metadata_location' => 'SOGoSAML2IdpMetadataLocation',
'saml2_idp_public_key_location' => 'SOGoSAML2IdpPublicKeyLocation',
'saml2_idp_certificate_location' => 'SOGoSAML2IdpCertificateLocation',
'saml2_login_attribute' => 'SOGoSAML2LoginAttribute',
'saml2_logout_enabled' => 'SOGoSAML2LogoutEnabled',
'saml2_logout_url' => 'SOGoSAML2LogoutURL',
'time_zone' => 'SOGoTimeZone',
'mail_domain' => 'SOGoMailDomain',
'appointment_send_email_notifications' => 'SOGoAppointmentSendEMailNotifications',
'folders_send_email_notifications' => 'SOGoFoldersSendEMailNotifications',
'acls_send_email_notifications' => 'SOGoACLsSendEMailNotifications',
'calendar_default_roles' => 'SOGoCalendarDefaultRoles',
'contacts_default_roles' => 'SOGoContactsDefaultRoles',
'super_usernames' => 'SOGoSuperUsernames',
'language' => 'SOGoLanguage',
'notify_on_personal_modifications' => 'SOGoNotifyOnPersonalModifications',
'notify_on_external_modifications' => 'SOGoNotifyOnExternalModifications',
'ldap_contact_info_attribute' => 'SOGoLDAPContactInfoAttribute',
'iphone_force_all_day_transparency' => 'SOGoiPhoneForceAllDayTransparency',
'enable_public_access' => 'SOGoEnablePublicAccess',
'disable_sharing' => 'SOGoDisableSharing',
'password_change_enabled' => 'SOGoPasswordChangeEnabled',
'supported_languages' => 'SOGoSupportedLanguages',
'hide_system_email' => 'SOGoHideSystemEMail',
'search_minimum_word_length' => 'SOGoSearchMinimumWordLength',
'maximum_failed_login_count' => 'SOGoMaximumFailedLoginCount',
'maximum_failed_login_interval' => 'SOGoMaximumFailedLoginInterval',
'failed_login_block_interval' => 'SOGoFailedLoginBlockInterval',
'maximum_message_submission_count' => 'SOGoMaximumMessageSubmissionCount',
'maximum_recipient_count' => 'SOGoMaximumRecipientCount',
'maximum_submission_interval' => 'SOGoMaximumSubmissionInterval',
'message_submission_block_interval' => 'SOGoMessageSubmissionBlockInterval',
'maximum_request_count' => 'SOGoMaximumRequestCount',
'maximum_request_interval' => 'SOGoMaximumRequestInterval',
'request_block_interval' => 'SOGoRequestBlockInterval',
'xsrf_validation_enabled' => 'SOGoXSRFValidationEnabled',
'user_sources' => 'SOGoUserSources',
'password_recovery_enabled' => 'SOGoPasswordRecoveryEnabled',
'password_recovery_domains' => 'SOGoPasswordRecoveryDomains',
'password_recovery_mode' => 'SOGoPasswordRecoveryMode',
'password_recovery_question' => 'SOGoPasswordRecoveryQuestion',
'password_recovery_question_answer' => 'SOGoPasswordRecoveryQuestionAnswer',
'password_recovery_secondary_email' => 'SOGoPasswordRecoverySecondaryEmail',
'jwt_secret' => 'SOGoJWTSecret',
'create_identities_disabled' => 'SOGoCreateIdentitiesDisabled',
'type' => 'type',
'id' => 'id',
'cn_field_name' => 'CNFieldName',
'id_field_name' => 'IDFieldName',
'uid_field_name' => 'UIDFieldName',
'mail_field_names' => 'MailFieldNames',
'search_field_names' => 'SearchFieldNames',
'imap_host_field_name' => 'IMAPHostFieldName',
'imap_login_field_name' => 'IMAPLoginFieldName',
'sieve_host_field_name' => 'SieveHostFieldName',
'base_dn' => 'baseDN',
'kind_field_name' => 'KindFieldName',
'multiple_bookings_field_name' => 'MultipleBookingsFieldName',
'filter' => 'filter',
'scope' => 'scope',
'bind_dn' => 'bindDN',
'bind_password' => 'bindPassword',
'bind_as_current_user' => 'bindAsCurrentUser',
'bind_fields' => 'bindFields',
'lookup_fields' => 'lookupFields',
'hostname' => 'hostname',
'user_password_algorithm' => 'userPasswordAlgorithm',
'can_authenticate' => 'canAuthenticate',
'password_policy' => 'passwordPolicy',
'update_samba_ntlm_passwords' => 'updateSambaNTLMPasswords',
'is_address_book' => 'isAddressBook',
'list_requires_dot' => 'listRequiresDot',
'modules_constraints' => 'ModulesConstraints',
'mapping' => 'mapping',
'object_classes' => 'objectClasses',
'group_object_classes' => 'GroupObjectClasses',
'modifiers' => 'modifiers',
'ab_ou' => 'abOU',
'ldap_query_limit' => 'SOGoLDAPQueryLimit',
'ldap_query_timeout' => 'SOGoLDAPQueryTimeout',
'ldap_group_expansion_enabled' => 'SOGoLDAPGroupExpansionEnabled',
'profile_url' => 'SOGoProfileURL',
'folder_info_url' => 'OCSFolderInfoURL',
'sessions_folder_url' => 'OCSSessionsFolderURL',
'email_alarms_folder_url' => 'OCSEMailAlarmsFolderURL',
'disable_organizer_event_check' => 'SOGoDisableOrganizerEventCheck',
'store_url' => 'OCSStoreURL',
'acl_url' => 'OCSAclURL',
'cache_folder_url' => 'OCSCacheFolderURL',
'view_url' => 'viewURL',
'user_password_policy' => 'userPasswordPolicy',
'prepend_password_scheme' => 'prependPasswordScheme',
'key_path' => 'keyPath',
'authentication_filter' => 'authenticationFilter',
'display_name' => 'displayName',
'login_field_names' => 'LoginFieldNames',
'domain_field_name' => 'DomainFieldName',
'mailing_mechanism' => 'SOGoMailingMechanism',
'smtp_server' => 'SOGoSMTPServer',
'smtp_authentication_type' => 'SOGoSMTPAuthenticationType',
'smtp_master_user_enabled' => 'SOGoSMTPMasterUserEnabled',
'smtp_master_user_username' => 'SOGoSMTPMasterUserUsername',
'smtp_master_user_password' => 'SOGoSMTPMasterUserPassword',
'send_mail' => 'WOSendMail',
'force_external_login_with_email' => 'SOGoForceExternalLoginWithEmail',
'drafts_folder_name' => 'SOGoDraftsFolderName',
'sent_folder_name' => 'SOGoSentFolderName',
'trash_folder_name' => 'SOGoTrashFolderName',
'junk_folder_name' => 'SOGoJunkFolderName',
'imap_cas_service_name' => 'SOGoIMAPCASServiceName',
'imap_server' => 'SOGoIMAPServer',
'sieve_server' => 'SOGoSieveServer',
'sieve_folder_encoding' => 'SOGoSieveFolderEncoding',
'mail_show_subscribed_folders_only' => 'SOGoMailShowSubscribedFoldersOnly',
'imap_acl_style' => 'SOGoIMAPAclStyle',
'imap_acl_conforms_to_imap_ext' => 'SOGoIMAPAclConformsToIMAPExt',
'mail_spool_path' => 'SOGoMailSpoolPath',
'mime_build_mime_temp_directory' => 'NGMimeBuildMimeTempDirectory',
'imap4_disable_imap4_pooling' => 'NGImap4DisableIMAP4Pooling',
'imap4_auth_mechanism' => 'NGImap4AuthMechanism',
'imap4_connection_group_id_prefix' => 'NGImap4ConnectionGroupIdPrefix',
'page_title' => 'SOGoPageTitle',
'help_url' => 'SOGoHelpURL',
'login_module' => 'SOGoLoginModule',
'favicon_relative_url' => 'SOGoFaviconRelativeURL',
'zip_path' => 'SOGoZipPath',
'soft_quota_ratio' => 'SOGoSoftQuotaRatio',
'mail_use_outlook_style_replies' => 'SOGoMailUseOutlookStyleReplies',
'mail_list_view_columns_order' => 'SOGoMailListViewColumnsOrder',
'mail_add_outgoing_addresses' => 'SOGoMailAddOutgoingAddresses',
'mail_certificate_enabled' => 'SOGoMailCertificateEnabled',
'selected_address_book' => 'SOGoSelectedAddressBook',
'external_avatars_enabled' => 'SOGoExternalAvatarsEnabled',
'gravatar_enabled' => 'SOGoGravatarEnabled',
'vacation_enabled' => 'SOGoVacationEnabled',
'vacation_period_enabled' => 'SOGoVacationPeriodEnabled',
'vacation_default_subject' => 'SOGoVacationDefaultSubject',
'vacation_header_template_file' => 'SOGoVacationHeaderTemplateFile',
'vacation_footer_template_file' => 'SOGoVacationFooterTemplateFile',
'forward_enabled' => 'SOGoForwardEnabled',
'forward_constraints' => 'SOGoForwardConstraints',
'forward_constraints_domains' => 'SOGoForwardConstraintsDomains',
'notification_enabled' => 'SOGoNotificationEnabled',
'sieve_scripts_enabled' => 'SOGoSieveScriptsEnabled',
'sieve_script_header_template_file' => 'SOGoSieveScriptHeaderTemplateFile',
'sieve_script_footer_template_file' => 'SOGoSieveScriptFooterTemplateFile',
'sieve_filters' => 'SOGoSieveFilters',
'refresh_view_intervals' => 'SOGoRefreshViewIntervals',
'refresh_view_check' => 'SOGoRefreshViewCheck',
'mail_auxiliary_user_accounts_enabled' => 'SOGoMailAuxiliaryUserAccountsEnabled',
'default_calendar' => 'SOGoDefaultCalendar',
'day_start_time' => 'SOGoDayStartTime',
'day_end_time' => 'SOGoDayEndTime',
'first_day_of_week' => 'SOGoFirstDayOfWeek',
'first_week_of_year' => 'SOGoFirstWeekOfYear',
'time_format' => 'SOGoTimeFormat',
'calendar_categories' => 'SOGoCalendarCategories',
'calendar_categories_colors' => 'SOGoCalendarCategoriesColors',
'calendar_events_default_classification' => 'SOGoCalendarEventsDefaultClassification',
'calendar_tasks_default_classification' => 'SOGoCalendarTasksDefaultClassification',
'calendar_default_reminder' => 'SOGoCalendarDefaultReminder',
'free_busy_default_interval' => 'SOGoFreeBusyDefaultInterval',
'dav_calendar_start_time_limit' => 'SOGoDAVCalendarStartTimeLimit',
'busy_off_hours' => 'SOGoBusyOffHours',
'mail_message_forwarding' => 'SOGoMailMessageForwarding',
'mail_custom_full_name' => 'SOGoMailCustomFullName',
'mail_custom_email' => 'SOGoMailCustomEmail',
'mail_reply_placement' => 'SOGoMailReplyPlacement',
'mail_reply_to' => 'SOGoMailReplyTo',
'mail_signature_placement' => 'SOGoMailSignaturePlacement',
'mail_use_signature_on_new' => 'SOGoMailUseSignatureOnNew',
'mail_use_signature_on_reply' => 'SOGoMailUseSignatureOnReply',
'mail_use_signature_on_forward' => 'SOGoMailUseSignatureOnForward',
'mail_compose_message_type' => 'SOGoMailComposeMessageType',
'mail_compose_window' => 'SOGoMailComposeWindow',
'enable_email_alarms' => 'SOGoEnableEMailAlarms',
'contacts_categories' => 'SOGoContactsCategories',
'ui_additional_js_files' => 'SOGoUIAdditionalJSFiles',
'mail_custom_from_enabled' => 'SOGoMailCustomFromEnabled',
'subscription_folder_format' => 'SOGoSubscriptionFolderFormat',
'uix_additional_preferences' => 'SOGoUIxAdditionalPreferences',
'mail_junk_settings' => 'SOGoMailJunkSettings',
'mail_keep_drafts_after_send' => 'SOGoMailKeepDraftsAfterSend',
'enable_domain_based_uid' => 'SOGoEnableDomainBasedUID',
'login_domains' => 'SOGoLoginDomains',
'domains_visibility' => 'SOGoDomainsVisibility',
'maximum_ping_interval' => 'SOGoMaximumPingInterval',
'maximum_sync_interval' => 'SOGoMaximumSyncInterval',
'internal_sync_interval' => 'SOGoInternalSyncInterval',
'maximum_sync_response_size' => 'SOGoMaximumSyncResponseSize',
'maximum_sync_window_size' => 'SOGoMaximumSyncWindowSize',
'eas_debug_enabled' => 'SOGoEASDebugEnabled',
'maximum_picture_size' => 'SOGoMaximumPictureSize',
'eas_search_in_body' => 'SOGoEASSearchInBody',
'eas_disable_ui' => 'SOGoEASDisableUI',
}.fetch(name, name)
end
end
|