        SOGoUserSources = (
            \{
{
    # If AllowedGroups prop is set, build a LDAP filter
    # based on the posixMemberOf attribute
    # (Only available on iPasserelle)

    my @groups = split(/[;,]/, ($sogod{'AllowedGroups'} || ''));
    $filter = '';
    if (scalar(@groups) == 1){
        $filter = "(posixMemberOf=$groups[0])";
    }
    elsif (scalar(@groups) gt 1){
        $filter = '(';
        my $i = 0;
        foreach (@groups){
            $i++;
            $filter .= "(posixMemberOf=$_)";
            $filter .= ' OR ' if ($i < scalar(@groups));
        }
        $filter .= ')';
    }
    $OUT .= ($filter eq '') ? '' : '                filter = "' . $filter . '";';
}
                CNFieldName = cn;
                IDFieldName = uid;
                UIDFieldName = uid;
                baseDN = "ou=Users,{ esmith::util::ldapBase($DomainName); }";
                bindFields = uid;
                canAuthenticate = YES;
                displayName = "{($sogo{'LDAPUserSourceName'} || 'Utilisateurs')}";
                hostname = localhost;
                id = users;
                isAddressBook = YES;
                port = {$ldap{'TCPPort'}};
                type = ldap;
            \},
            \{
{
    # Use the same filter, against the cn attr
    $filter =~ s/posixMemberOf=/cn=/g;
    $OUT .= ($filter eq '') ? '' : '                filter = "' . $filter . '";';
}
                CNFieldName = cn;
                IDFieldName = cn;
                UIDFieldName = cn;
                baseDN = "ou=Groups,{ esmith::util::ldapBase($DomainName); }";
                bindFields = cn;
                canAuthenticate = YES;
                displayName = "{($sogo{'LDAPGroupSourceName'} || 'Groupes')}";
                hostname = localhost;
                id = groups;
                isAddressBook = YES;
                port = {$ldap{'TCPPort'}};
                type = ldap;
            \}
        );
{
    my $auth = $sogod{'Authentication'} || 'cas';
    if (lc $auth eq 'cas' && -d '/var/service/dovecot'){
        $OUT .=<<"HERE";
        SOGoAuthenticationType = cas;
        SOGoCASServiceURL = "https://auth.$DomainName/cas/";
        SOGoCASLogoutEnabled = YES;
HERE
    }
}
