I think this is a normal behavior as LDAP users are created different than those created via incoming email. Having the same thing going on in [several] one installation[s]…
Babak
EDIT:
I am stupid. Just checked that in one installation. Simply spelled the domain wrong. argl. now it seems to work…
this script has been “slightly” tested and might react “odd” on big instances
we do not take any responsibility for wrong mapping, data loss, etc
Now to the fun part:
Magic to domain assign users if the organization has been created after user creation
# get organizations with domain based assignment and do magic to all users not having an organization yet
org=''
list=''
Organization.where(domain_assignment:true).pluck(:id).each{ |orgid|
org=Organization.find(orgid)
list += "Checking Organization: #{org.name} (#{org.domain}) \n"
next if org.domain == nil
User.where(organization_id:nil).where("email LIKE '%@#{org.domain}'").pluck(:id).each { |user|
list+= "... Found user (and upgraded to member): #{User.find(user).firstname} #{User.find(user).lastname} (#{User.find(user).email}) \n"
User.find(user).update!(organization_id: orgid)
}
org=''
}
puts list