Stefano Cecconello
2023-Jan-13 17:39 UTC
Add Userdb extra field to existing configuration settings, not overriding them
Hi, If i understood correctly the extra field feature ( https://doc.dovecot.org/configuration_manual/authentication/user_database_ex tra_fields/ ), any extra field that is passed from a SQL query will overwrite any existing settings on the dovecot.conf configuration file ( if present ) . For example, if i want to enable a plugin ( ex: acl ) on a per user basis, i would add a column\field ( ex: "acl_enabled" = 1 ) into my auth DB , then add into the dovecot password\user queries : . IF(acl_enabled = 0, NULL, 'acl imap_acl') AS mail_plugins . While having in the dovecot.conf this setting : . mail_plugins = quota notify protocol imap mail_plugins = $mail_plugins imap_quota .>From my test, this combination will lead to having the logging users withacl_enabled=1, a mail_plugins list of acl and imap_acl only, without the quota and notify plugins . If i change the acl_value to 0, the returned mail_plugins list is empty and it will not overrive\overwrite the dovecot.conf mail_plugins configuration . If it's correct, there is a way to merge both settings, like having in the dovecot.conf a minimal\base subset of settings and adding any additional values via SQL queries ? Thanks and best regards Stefano -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://dovecot.org/pipermail/dovecot/attachments/20230113/af903134/attachment.htm>
Aki Tuomi
2023-Jan-27 11:28 UTC
Add Userdb extra field to existing configuration settings, not overriding them
> On 13/01/2023 19:39 EET Stefano Cecconello <stefano.cecconello at staff.aruba.it> wrote: > > > Hi, > > If i understood correctly the extra field feature ( https://doc.dovecot.org/configuration_manual/authentication/user_database_extra_fields/ ), any extra field that is passed from a SQL query will overwrite any existing settings on the dovecot.conf configuration file ( if present ) . > > For example, if i want to enable a plugin ( ex: acl ) on a per user basis, i would add a column\field ( ex: ?acl_enabled? = 1 ) into my auth DB , then add into the dovecot password\user queries : > > ? > IF(acl_enabled = 0, NULL, 'acl imap_acl') AS mail_plugins > ? > > While having in the dovecot.conf this setting : > ? > mail_plugins = quota notify > > protocol imap > mail_plugins = $mail_plugins imap_quota > > ? > > From my test, this combination will lead to having the logging users with acl_enabled=1, a mail_plugins list of acl and imap_acl only, without the quota and notify plugins . > If i change the acl_value to 0, the returned mail_plugins list is empty and it will not overrive\overwrite the dovecot.conf mail_plugins configuration . > > If it?s correct, there is a way to merge both settings, like having in the dovecot.conf a minimal\base subset of settings and adding any additional values via SQL queries ? > > Thanks and best regards > StefanoYou could try: IF(acl_enabled = 0, NULL, 'acl imap_acl') AS mail_plugins_extra and in config mail_plugins = $mail_plugins $mail_plugins_extra Aki