Hi,
I am trying to use ActiveLdap for authentication in my rails app. But I
am running into a problem with the “belongs_to” and “has_many”
associations.
Here ist how my models look like.
class Person < ActiveLdap::Base
ldap_mapping :dn_attribute => “uid”,
:prefix => “ou=People”,
:classes => [‘top’, ‘account’, ‘posixAccount’]
belongs_to :groups, :class => ‘Group’, :many => ‘memberUid’
end
class Group < ActiveLdap::Base
ldap_mapping :dn_attribute => “cn”,
:prefix => “ou=Group”,
:classes => [‘posixGroup’,‘top’]
has_many :member, :class => “Person”, :wrap => “memberUid”
end
According to ActiveLdap documentation I am testing the association.
irb> me = User.find(‘aebel’)
irb> me.groups.each { |group| p group.cn };nil
“develop”
“wheel”
=> nil
So far everything works fine. But when I try to do a membership test, it
fails.
irb> me.groups.member? ‘wheel’
=> false
My environment:
Rails 2.2.2
AciveLdap SVN revision 802
Any help will be appreciated
Alexander Ebel