Allow setting userAttrs to empty string

This allows overwriting the default values for user_attrs to be empty
which is required when using virtual mailboxes with ldap accounts
that have posixAccount attributes set. When user_attrs is empty string
those are ignored then.
This commit is contained in:
Sandro Jäckel 2024-07-13 00:31:30 +02:00
parent 290a995de5
commit 059b50b2e7
No known key found for this signature in database
GPG key ID: 3AF5A43A3EECC2E5
2 changed files with 2 additions and 2 deletions

View file

@ -277,7 +277,7 @@ in
dovecot = {
userAttrs = mkOption {
type = types.str;
type = types.nullOr types.str;
default = "";
description = ''
LDAP attributes to be retrieved during userdb lookups.

View file

@ -76,7 +76,7 @@ let
auth_bind = yes
base = ${cfg.ldap.searchBase}
scope = ${mkLdapSearchScope cfg.ldap.searchScope}
${lib.optionalString (cfg.ldap.dovecot.userAttrs != "") ''
${lib.optionalString (cfg.ldap.dovecot.userAttrs != null) ''
user_attrs = ${cfg.ldap.dovecot.userAttrs}
''}
user_filter = ${cfg.ldap.dovecot.userFilter}